Fixed possible crasher with empty groups on aggregation