Fixed bug in counter.