Fix a bug in checkpoint to make multi-gpu version work