checks the database to ensure that the count is correct.