some fix on save state and load state