call the count function correctly