better mask handling
better mask handling