fixed counter issue

a simple off-by-one error