Count fix

Whenever we do total_entries on a collection of active record objects on a query that contains GROUP BY, it converts collection into hash and return its count whereas it should return count of the active relation and not the hash.