fixed bug where query was resetting when count was called