--- modules/token/token_node.inc.orig	Mon Feb 23 20:05:49 2009
+++ modules/token/token_node.inc	Tue Feb 24 05:59:18 2009
@@ -105,7 +105,8 @@
       if (module_exists('taxonomy') && !empty($node->taxonomy) && is_array($node->taxonomy)) {
         foreach ($node->taxonomy as $term) {
           $original_term = $term;
-          if ((object)$term) {
+          if (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
@@ -119,14 +120,6 @@
               $term->vid = $vid;
             }
 
-            // Ok, if we still don't have a term name maybe this is a pre-taxonomy submit node
-            // So if it's a number we can get data from it
-            if (!isset($term->name) && is_array($original_term)) {
-              $tid = array_shift($original_term);
-              if (is_numeric($tid)) {
-                $term = taxonomy_get_term($tid);
-              }
-            }
             $values['term'] = check_plain($term->name);
             $values['term-strtolower'] = strtolower(check_plain($term->name));
             $values['term-raw'] = $term->name;
@@ -149,6 +142,36 @@
             // tokens, *it* should handle this catpath alias as it's the primary consumer.
             break;
           }
+	  else {
+
+           // Ok, if we still don't have a term name maybe this is a pre-taxonomy submit node
+            // So if it's a number we can get data from it
+            if (is_array($original_term)) {
+              $tid = array_shift($original_term);
+              if (is_numeric($tid)) {
+                $term = taxonomy_get_term($tid);
+              }
+            }
+	    else {
+              if (is_numeric($term)) {
+		  $term = taxonomy_get_term($term);
+              }
+	    }
+
+            $values['term'] = check_plain($term->name);
+            $values['term-strtolower'] = strtolower(check_plain($term->name));
+            $values['term-raw'] = $term->name;
+            $values['term-id'] = $term->tid;
+            $vid = $term->vid;
+
+            if (!empty($vid)) {
+              $vocabulary = taxonomy_vocabulary_load($vid);
+              $values['vocab'] = check_plain($vocabulary->name);
+              $values['vocab-raw'] = $vocabulary->name;
+              $values['vocab-id'] = $vocabulary->vid;
+            }
+	    break;
+	  }
         }
       }
       // It's possible to leave that block and still not have good data.
