diff -Naur hierarchical_select.old/modules/hs_taxonomy.module hierarchical_select/modules/hs_taxonomy.module
--- hierarchical_select.old/modules/hs_taxonomy.module	2011-09-07 16:57:57.000000000 +0200
+++ hierarchical_select/modules/hs_taxonomy.module	2011-11-12 18:44:33.000000000 +0100
@@ -395,6 +395,12 @@
   // Extract required field information.
   $vocabulary = taxonomy_vocabulary_machine_name_load($field['settings']['allowed_values'][0]['vocabulary']);
 
+  $tree = taxonomy_get_tree($vocabulary->vid);
+  $tids = array();
+  foreach ($tree as $leaf) {
+    $tids[$leaf->name] = $leaf->tid;
+  }
+
   // Extract the lineage information from the items (this was added by
   // hs_taxonomy_field_formatter_prepare_view()).
   $lineages = array();
@@ -403,10 +409,10 @@
 
     for ($i = 0; $i < count($metadata); $i++) {
       $term = new StdClass();
-      $term->tid = $item['tid'];
       $term->vid = $vocabulary->vid;
       $term->vocabulary_machine_name = $vocabulary->machine_name;
       $term->name = $metadata[$i]['label'];
+      $term->tid = $tids[$term->name];
 
       $lineages[$metadata[$i]['lineage']][$metadata[$i]['level']] = $term;
     }
