Fix glitch with counter