modify save_state.