diff --git a/autocategorise.module b/autocategorise.module
index e4135ed..2783f81 100755
--- a/autocategorise.module
+++ b/autocategorise.module
@@ -248,7 +248,16 @@ function _apply_vocab_to_node($vid, $node, $terms, $vocab){
   }
   //tax_node save refreshes all the terms applied to this node, not just the ones from this vocab
   //so we have to get all the current terms
-  $otherterms = db_fetch_array(db_query("SELECT d.tid from {term_node} n LEFT JOIN {term_data} d on n.tid = d.tid WHERE n.nid = %d AND d.vid <> %d", $node->nid, $vid));
+  //$otherterms = db_fetch_array(db_query("SELECT d.tid from {term_node} n LEFT JOIN {term_data} d on n.tid = d.tid WHERE n.nid = %d AND d.vid <> %d", $node->nid, $vid));
+  
+  $otherterms = array();
+  $vocabularies = taxonomy_get_vocabularies();
+  foreach($vocabularies as $vocabulary) {
+    if ($vocabulary->vid != $vid) {
+      $node_terms = taxonomy_node_get_terms_by_vocabulary($node, $vocabulary->vid);
+      $otherterms = array_merge($otherterms, $node_terms);
+    }
+  }
   if (is_array($otherterms)) {
     $matches = array_merge($matches, $otherterms);
   }
