add test for counting records with query