fixes error in count method