additional logic to fix Mask Confusion issue #26