fixed group_by and test for minmax_by