add a cast to initialisation of mask