fixed bug generating states when saving and reloading