Fixed bug in entity_to_dict().