diff --git a/facetapi_taxonomy_sort/facetapi_taxonomy_sort.module b/facetapi_taxonomy_sort/facetapi_taxonomy_sort.module
index a1ea5b1..d2429c4 100644
--- a/facetapi_taxonomy_sort/facetapi_taxonomy_sort.module
+++ b/facetapi_taxonomy_sort/facetapi_taxonomy_sort.module
@@ -15,7 +15,7 @@
  */
 function facetapi_taxonomy_sort_is_term_reference_field(array $facet) {
   if ($facet['field api name'] && ($field_info = field_info_field($facet['field api name']))) {
-    return ('taxonomy_term_reference' == $field_info['type']);
+    return ('taxonomy_term_reference' == $field_info['type'] || ('entityreference' == $field_info['type'] && $field_info['settings']['target_type'] == 'taxonomy_term'));
   }
   else {
     // For Search API, fall back to the field type key.
@@ -86,6 +86,14 @@ function facetapi_taxonomy_sort_is_taxonomy_facet(array $realm, array $facet, $o
  * Sorts by taxonomy weight.
  */
 function facetapi_taxonomy_sort_sort_taxonopmy(array $a, array $b) {
+  if (!isset($a['#taxonomy_weight'])) {
+    $term_a = taxonomy_term_load($a['#indexed_value']);
+    $a['#taxonomy_weight'] = $term_a->weight;
+  }
+  if (!isset($b['#taxonomy_weight'])) {
+    $term_b = taxonomy_term_load($b['#indexed_value']);
+    $b['#taxonomy_weight'] = $term_b->weight;
+  }
   $a_count = (isset($a['#taxonomy_weight'])) ? $a['#taxonomy_weight'] : 0;
   $b_count = (isset($b['#taxonomy_weight'])) ? $b['#taxonomy_weight'] : 0;
   if ($a_count == $b_count) {
