Be more forgiving if PREF_MY_KEY is missing. Fixed 3 potential memory leaks.