fix grouping order bug