fix bug when defining multiple counters