need to rework restorePreferences