Reset counter properly