Fix false positive in mask -> mask_img replacement