fixed group by issue