added check that shared prefs exists before reading