MDL-26577 fix several groups and groupings issues