mask_create modified to fix mask retrieve problem