Re #5295. Added warnings if bad masking or grouping.