Fix how the entity type is retrieved.