Fix state file functionality.