count method crash fix