Corrects NPE when loading entities.