Fix error restoring and saving cache.