fixed checkpointing logic (again)