Fix state file persistence
Merge pull request #198 from driskell/bugs/statefile_persistence

Fix state file persistence