make query for counts consistent