fixed save-state bug