undo counting moves correctly