diff --git a/bulk_photo_nodes.module b/bulk_photo_nodes.module
index 27fcead..ad91d41 100644
--- a/bulk_photo_nodes.module
+++ b/bulk_photo_nodes.module
@@ -663,16 +663,7 @@ function bulk_photo_nodes_recursive_ajax(&$element) {
     foreach (element_children($element) as $child) {
       bulk_photo_nodes_recursive_ajax($element[$child]);
     }
-    if (isset($element['#ajax']) && is_array($element['#ajax'])) {
-      $element['#ajax'][] = array(
-        'event' => 'change',
-        'wrapper' => 'bpn-nodes',
-        'callback' => 'bulk_photo_nodes_add_form_ajax',
-        'method' => 'replace',
-        'progress' => array('type' => 'none'),
-      );
-    }
-    else {
+    if (empty($element['#ajax'])) {
       $element['#ajax'] = array(
         'event' => 'change',
         'wrapper' => 'bpn-nodes',
@@ -682,7 +673,10 @@ function bulk_photo_nodes_recursive_ajax(&$element) {
       );
     }
     if (!empty($element['#autocomplete_path'])) {
-      $element['#element_validate'] = array('bulk_photo_nodes_taxonomy_autocomplete_validate');
+      $field_info = field_info_field($element['#field_name']);
+      if ($field_info['settings']['target_type'] == 'taxonomy_term') {
+        $element['#element_validate'] = array('bulk_photo_nodes_taxonomy_autocomplete_validate');
+      }
     }
     elseif (!empty($element['#type']) && $element['#type'] == 'select') {
       if (!empty($element['#value_key']) && $element['#value_key'] == 'tid') {
@@ -691,16 +685,21 @@ function bulk_photo_nodes_recursive_ajax(&$element) {
     }
   }
   else {
-    $element['#ajax'] = array(
-      'event' => 'change',
-      'wrapper' => 'bpn-nodes',
-      'callback' => 'bulk_photo_nodes_add_form_ajax',
-      'method' => 'replace',
-      'progress' => array('type' => 'none'),
-    );
+    if (empty($element['#ajax'])) {
+      $element['#ajax'] = array(
+        'event' => 'change',
+        'wrapper' => 'bpn-nodes',
+        'callback' => 'bulk_photo_nodes_add_form_ajax',
+        'method' => 'replace',
+        'progress' => array('type' => 'none'),
+      );
+    }
     if (!empty($element['#autocomplete_path'])) {
       // Add custom validation for autocomplete taxonomy textfields.
-      $element['#element_validate'] = array('bulk_photo_nodes_taxonomy_autocomplete_validate');
+      $field_info = field_info_field($element['#field_name']);
+      if ($field_info['settings']['target_type'] == 'taxonomy_term') {
+        $element['#element_validate'] = array('bulk_photo_nodes_taxonomy_autocomplete_validate');
+      }
     }
     elseif (!empty($element['#type']) && $element['#type'] == 'select') {
       // Add custom validation for taxonomy selects.
@@ -786,30 +785,35 @@ function bulk_photo_nodes_taxonomy_autocomplete_validate(&$element, &$form_state
   if ($tags = $element['#value']) {
     // Collect candidate vocabularies.
     $field_info = field_info_field($element['#field_name']);
-    $field_instance = field_info_instance($element['#entity_type'], $element['#field_name'], $element['#bundle']);
-    $vocabularies = array();
-    foreach ($field_info['settings']['allowed_values'] as $tree) {
-      if ($vocabulary = taxonomy_vocabulary_machine_name_load($tree['vocabulary'])) {
-        $vocabularies[$vocabulary->vid] = $vocabulary;
+    if ($field_info['settings']['target_type'] == 'taxonomy_term') {
+      $field_instance = field_info_instance($element['#entity_type'], $element['#field_name'], $element['#bundle']);
+      $vocabularies = array();
+      foreach ($field_info['settings']['handler_settings']['target_bundles'] as $tree) {
+        if ($vocabulary = taxonomy_vocabulary_machine_name_load($tree)) {
+          $vocabularies[$vocabulary->vid] = $vocabulary;
+        }
       }
-    }
 
-    // Translate term names into actual terms.
-    $typed_terms = drupal_explode_tags($tags);
-    foreach ($typed_terms as $typed_term) {
-      // See if the term exists in the chosen vocabulary and return the tid;
-      // otherwise, create a new 'autocreate' term for insert/update.
-      if ($possibilities = taxonomy_term_load_multiple(array(), array('name' => trim($typed_term), 'vid' => array_keys($vocabularies)))) {
-        $term = array_pop($possibilities);
-      }
-      else {
-        $vocabulary = reset($vocabularies);
-        $term = array(
-          'tid' => 'autocreate',
-          'vid' => $vocabulary->vid,
-          'name' => $typed_term,
-          'vocabulary_machine_name' => $vocabulary->machine_name,
-        );
+      if (!empty($vocabularies)) {
+        // Translate term names into actual terms.
+        $typed_terms = drupal_explode_tags($tags);
+        foreach ($typed_terms as $typed_term) {
+          // See if the term exists in the chosen vocabulary and return the tid;
+          // otherwise, create a new 'autocreate' term for insert/update.
+          if ($possibilities = taxonomy_term_load_multiple(array(), array('name' => trim($typed_term), 'vid' => array_keys($vocabularies)))) {
+            $term = array_pop($possibilities);
+          }
+          else {
+            $vocabulary = reset($vocabularies);
+            $term = array(
+              'tid' => 'autocreate',
+              'vid' => $vocabulary->vid,
+              'name' => $typed_term,
+              'vocabulary_machine_name' => $vocabulary->machine_name,
+            );
+          }
+          $value[] = (array) $term;
+        }
       }
       $value[] = (array) $term;
     }
