rework of save/load state