Fixed NullPointerException in Preferences