Fix for misuse of mask flag