diff --git a/plugins/selection/EntityReference_SelectionHandler_Generic.class.php b/plugins/selection/EntityReference_SelectionHandler_Generic.class.php
index 444a74c..4468632 100644
--- a/plugins/selection/EntityReference_SelectionHandler_Generic.class.php
+++ b/plugins/selection/EntityReference_SelectionHandler_Generic.class.php
@@ -170,13 +170,37 @@ class EntityReference_SelectionHandler_Generic implements EntityReference_Select
       $entities = entity_load($entity_type, array_keys($results[$entity_type]));
       foreach ($entities as $entity_id => $entity) {
         list(,, $bundle) = entity_extract_ids($entity_type, $entity);
-        $options[$bundle][$entity_id] = check_plain($this->getLabel($entity));
+        $options[$bundle][$entity_id] = $this->getReference($this->field, $entity);
       }
     }
 
     return $options;
   }
 
+  public function getReference($field, $entity) {
+    //this code gets the entity property or field property required
+    $sort = $this->field['settings']['handler_settings']['sort'];
+    switch ($sort['type']) {
+      case 'field':
+        $item = explode(':', $sort['field']);
+        $fld = $item[0];
+        $fld_key = $item[1];
+        $val = $entity->$fld;
+        $rtn = $val['und'][0][$fld_key];
+        break;
+
+      case 'property':
+        $key = $sort['property'];
+        $rtn = $entity->$key;
+        break;
+
+      default: //this came from earlier code.  hopefully it never gets executed again
+        $rtn = $this->getLabel($entity);
+        break;
+    }
+    return $rtn;
+  }
+
   /**
    * Implements EntityReferenceHandler::countReferencableEntities().
    */
@@ -231,7 +255,7 @@ class EntityReference_SelectionHandler_Generic implements EntityReference_Select
       }
       else {
         // Take the one and only matching entity.
-        return key($entities);
+        return key($entities[key($entities)]);
       }
   }
 
@@ -245,9 +269,16 @@ class EntityReference_SelectionHandler_Generic implements EntityReference_Select
       $query->entityCondition('bundle', $this->field['settings']['handler_settings']['target_bundles'], 'IN');
     }
     if (isset($match)) {
-      $entity_info = entity_get_info($this->field['settings']['target_type']);
-      if (isset($entity_info['entity keys']['label'])) {
-        $query->propertyCondition($entity_info['entity keys']['label'], $match, $match_operator);
+      $sort = $this->field['settings']['handler_settings']['sort'];
+      if ($sort['type'] == 'field') {//get field values
+        $item = explode(':', $sort['field']);
+        $fld = $item[0];
+        $fld_key = $item[1];
+        $query->entityCondition($fld . '_' . $fld_key, $match, $match_operator);
+      }
+      elseif ($sort['type'] == 'property') {//get entity properties
+        $key = $sort['property'];
+        $query->propertyCondition($key, $match, $match_operator);
       }
     }
 
@@ -343,6 +374,7 @@ class EntityReference_SelectionHandler_Generic implements EntityReference_Select
     // Return the alias of the table.
     return $query->innerJoin($target_type, NULL, "%alias.$id = $alias.entity_id");
   }
+
 }
 
 /**
