--- ../../../../../sites/all/modules/feeds/mappers/content_taxonomy.inc	2010-10-28 13:14:28.000000000 -0700
+++ mappers/content_taxonomy.inc	2011-03-23 13:39:49.922032900 -0700
@@ -63,18 +63,38 @@
   $tags = $field['widget']['type'] == 'content_taxonomy_autocomplete' && $field['widget']['new_terms'];
   $multiple = $field['widget']['multiple'];
 
+  // make a hash of the existing term ids in the field:
+  $tids_used = array();
+  if(is_array($node->$field_name)) { 
+    foreach($node->$field_name as $term_entry) {
+      $tids_used[$term_entry['value']] = TRUE;
+    }
+  }
+
   foreach ($terms as $k => $term_name) {
-   $term_name = trim($term_name);
+    if ($multiple != 0 && is_array($node->$field_name) && count($node->$field_name) >= $multiple) {
+      // Stop if the field has a limited number of values and the limit is reached.
+      break;
+    }
+
+    $term_name = trim($term_name);
     if ($terms_found = content_taxonomy_get_term_by_name_vid($term_name, $field['vid'])) {
       // If any terms are found add them to the field by found tid.
       foreach($terms_found as $term_found) {
-        if(!is_array($node->$field_name)) $node->$field_name = array();
-        array_push($node->$field_name, array('value' => $term_found['tid']));
-        if ($multiple != 0 && count($node->$field_name) >= $multiple) {
-          // If the vocab is not for multiple tags break after the first hit.
+        if ($multiple != 0 && is_array($node->$field_name) && count($node->$field_name) >= $multiple) {
+          // Stop if the field has a limited number of values and the limit is reached.
           break;
         }
-      }
+
+        if(!is_array($node->$field_name)) $node->$field_name = array();
+ 
+        // Determine if the term is already in the field. If not, add it. This prevents duplicates.
+        if(!$tids_used[$term_found['tid']]) {
+          array_push($node->$field_name, array('value' => $term_found['tid']));
+          $tids_used[$term_found['tid']] = TRUE;
+        }
+
+     }
     }
     else if ($tags) {
       // If the field is configured for free tagging, create a new term
@@ -86,11 +106,9 @@
       if (!is_array($node->$field_name)) {
         $node->$field_name = array();
       }
+
       array_push($node->$field_name, array('value' => $edit['tid']));
-    }
-    if ($multiple != 0 && count($node->$field_name) >= $multiple) {
-      // If the vocab is not for multiple tags break after a first term has been added.
-      break;
+      $tids_used[$term_found['tid']] = TRUE;
     }
   }
 }
