State should also be saved if there is a problem in the onBeforeSave
Merge pull request #306 from roland-d/savestate

State should also be saved if there is a problem in the onBeforeSave