Force the resync count to be an integer.
Tidy up some confusing code relating to resync counts.