Increment counter properly