fix has_entities bug