--- term_fields/term_fields.installORIG	2011-11-29 14:40:22.000000000 -0800
+++ term_fields/term_fields.install	2011-11-29 14:38:54.000000000 -0800
@@ -196,9 +196,6 @@
     // Update term_fields tables (columns and/or values).
     term_fields_database_update_6101($ret);
     
-    // Add terms vid to the {term_fields_term} table;
-    
-    
     // Removes deprecated entries in {variables} table.
     db_query("DELETE FROM {variable} WHERE name LIKE 'term_fields_%'");
     
@@ -338,3 +335,23 @@
     }
   }
 }
+
+/**
+ * Implementation of hook_update_N().
+ */
+function term_fields_update_6200() {
+  // We now have to set the vid for each row, otherwise they'll be 0
+  // see https://drupal.org/node/1356140
+  $ret = array();
+  
+  $result = db_query("SELECT tid, vid FROM {term_fields_term}");
+  while ($row = db_fetch_object($result)) {
+    // if the vid is 0, it is incorrect and needs to be updated
+    if ($row->vid == 0) {
+      $vid = db_result(db_query("SELECT vid FROM {term_data} WHERE tid = %d", $row->tid));
+      $ret[] = update_sql("UPDATE {term_fields_term} SET vid = '". $vid ."' WHERE tid = '". $row->tid ."'");
+    }
+  }
+  
+  return $ret;
+}
