fix mask shifting