Fixed error in OR logic on masking