initial state save and restore