=== modified file 'sites/all/modules/hierarchical_select/modules/hs_taxonomy.module'
--- modules/hs_taxonomy.module	2011-02-14 06:06:21 +0000
+++ modules/hs_taxonomy.module	2011-04-24 16:14:48 +0000
@@ -652,11 +652,29 @@ function hs_taxonomy_token_values($type,
         }
       }
 
+      // Build consistency to handle all three forms of $node->taxonomy
+      $terms_by_vocab = array();
+      foreach ($node->taxonomy as $key => $item) {
+        if (is_object($item)) {
+          $terms_by_vocab[$item->vid][$item->tid] = $item->tid;
+        }
+        elseif (is_array($item)) {
+          foreach ($item as $index => $term) {
+            $term = is_object($term) ? $term : taxonomy_get_term($term);
+            $terms_by_vocab[$term->vid][$term->tid] = $term->tid;
+          }
+        }
+        elseif (is_numeric($item)) {
+          $term = taxonomy_get_term($item);
+          $terms_by_vocab[$term->vid][$term->tid] = $term->tid;
+        }
+      }
+
       // Generate the per-vid "save-lineage-termpath" tokens.
       foreach ($all_vids as $vid) {
         $terms = array();
-        if (in_array($vid, $hs_vids) && isset($node->taxonomy[$vid])) {
-          $selection = $node->taxonomy[$vid];
+        if (in_array($vid, $hs_vids) && isset($terms_by_vocab[$vid])) {
+          $selection = $terms_by_vocab[$vid];
           $terms = _hs_taxonomy_token_termpath_for_vid($selection, $vid);
         }
 
@@ -668,7 +686,7 @@ function hs_taxonomy_token_values($type,
 
       // We use the terms of the first vocabulary that uses Hierarchical
       // Select for the default "save-lineage-termpath" tokens.
-      $vids = array_intersect(array_keys($node->taxonomy), $hs_vids);
+      $vids = array_intersect(array_keys($terms_by_vocab), $hs_vids);
       if (!empty($vids)) {
         $vid = $vids[0];
         $values['save-lineage-termpath'] = $values["save-lineage-termpath:$vid"];
@@ -703,9 +721,11 @@ function _hs_taxonomy_token_termpath_for
   $selection = (is_array($selection)) ? $selection : array($selection);
 
   // Generate the part we'll need of the Hierarchical Select configuration.
+  module_load_include('inc', 'hierarchical_select', 'includes/common');
+  $vid_config = hierarchical_select_common_config_get("taxonomy-$vid");
   $config = array(
     'module'       => 'hs_taxonomy',
-    'save_lineage' => 1,
+    'save_lineage' => $vid_config['save_lineage'],
     'params' => array(
       'vid'         => $vid,
       'exclude_tid' => NULL,

