fixed checkpointing bug