--- D:\src\drupal\5.0\modules\token\token_node.inc	Wed Oct 31 19:57:25 2007 UTC
+++ D:\src\htdocs\drupal5\modules\token\token_node.inc	Thu Nov 1 09:21:54 2007 UTC
@@ -83,8 +83,24 @@
       // And now taxonomy, which is a bit more work. This code is adapted from
       // pathauto's handling code; it's intended for compatability with it.
       if (module_exists('taxonomy') && !empty($node->taxonomy) && is_array($node->taxonomy)) {
-        foreach ($node->taxonomy as $term) {
-          if ((object)$term) {
+        foreach ($node->taxonomy as $vid_key => $term) {
+          if (is_array($term) || is_numeric($term)) {
+            $tid = is_array($term) ? reset($term) : $term;
+            $name = db_result(db_query("SELECT t.name FROM {term_data} t WHERE t.tid = %d", $tid));
+
+            $values['term'] = check_plain($name);
+            $values['term-raw'] = $name;
+            $values['term-id'] = $tid;
+
+            if(!empty($vid_key)) {
+              $vocabulary = taxonomy_get_vocabulary($vid_key);
+              $values['vocab'] = check_plain($vocabulary->name);
+              $values['vocab-raw'] = $vocabulary->name;
+              $values['vocab-id'] = $vocabulary->vid;
+            }
+            break;
+
+          } elseif (is_object($term)) {
             // With freetagging it's somewhat hard to get the tid, vid, name values
             // Rather than duplicating taxonomy.module code here you should make sure your calling module
             // has a weight of at least 1 which will run after taxonomy has saved the data which allows us to 
