fix bugs: some programs may modify the input buffer so the current value must be stored when a checkpoint is taken