Change counter int to long to avoid reset at INT_MAX_VALUE