fixed minor bug in counter