Fixed checkpointing bug