fixed bug in group by time