PHANTOM-81: Fixed wrong limit usage of count queries.