fixed counter issue

typical off-by-one error