Moving the counter reset to the end of the try will more reliably reset the counter if the scanner is connected, allowing for fewer false positives for disconnected card readers.