improved error handling to read state file #2