support saving session state whenever modified and loading it on startup