Bugfix in count method