Fix NPE in EntityHelper