fixed checking entity type