Fix bug in issue #3, counter value incorrect

This fixes a bug in #3 whereby the count is incorrect.