Fix correction for counter overflow.
Corrected faulty 'fix' for the counter overflow handling code