fix bugs when using group by and track by