Fix bug on group by using day