diff --git a/entityreference.module b/entityreference.module
index bdcb562..b6569a8 100644
--- a/entityreference.module
+++ b/entityreference.module
@@ -796,7 +796,7 @@ function entityreference_field_widget_form(&$form, &$form_state, $field, $instan
   if (empty($entity_info)){
     return;
   }
-  $entity_type = $instance['entity_type'];
+  $entity_type = $element['#entity_type'];
   $entity = isset($element['#entity']) ? $element['#entity'] : NULL;
   $handler = entityreference_get_selection_handler($field, $instance, $entity_type, $entity);
 
