Fix #1572 (saveState): create saveState feature
Merge pull request #2402 from PaulL1/1572_save_state

Fix #1572 (saveState): create saveState feature