Fix error in count() method