Fix source of NPE crashes