fixed group by bug