Fixed nullpointerException in setNamingPref