Fix overflow: count1 may be large, resulting in negative checkpoint_int and an infinite loop a few lines down.