added null check to NamedEntity