Fix crash when prefs have not been set