Fix restoring and saving settings when session is not set