Mask mode: Various tweaks. See #837