handling NPE in Profiles and communities