Fixed bug with state file handling.