improve processing of motion mask