Fix mask logic for monowriter