If default path is not writable, fallback to tmp dir.
Clean up applyState