Bugfix on rows counting with group by