--- ./modules/taxonomy_access/taxonomy_access.module	2007-07-03 18:19:48.000000000 -0400
+++ ./modules/taxonomy_access/taxonomy_access.module.new	2007-11-27 13:37:34.360170017 -0500
@@ -234,15 +234,19 @@ function taxonomy_access_taxonomy($op, $
   if ($type == 'term') {
     switch($op) {
       case 'delete': // delete everything from term_access and node_access
+        $affected_nodes = _taxonomy_access_get_nodes_for_term($array['tid']);
         db_query('DELETE FROM {term_access} WHERE tid = %d',$array['tid']);
-        node_access_rebuild();
+        _taxonomy_access_node_access_update($affected_nodes);
+        //node_access_rebuild();
         break;
     }
   }
   if ($type == 'vocabulary') {
     switch($op) {
       case 'delete': // delete vocabulary from table 'term_access_defaults'
+        $affected_nodes = _taxonomy_access_get_nodes_for_vocabulary($vid, $array['vid']);
         db_query('DELETE FROM {term_access_defaults} WHERE vid = %d',$array['vid']);
+        _taxonomy_access_node_access_update($affected_nodes);
         // TODO: need rebuild here? can we avoid multiple rebuilds on large vocab delete?
         break;
     }
@@ -288,7 +292,7 @@ function taxonomy_access_db_rewrite_sql(
                       LEFT JOIN {term_access_defaults} td ON td.vid=t.vid AND td.rid=tdg.rid
                       LEFT JOIN {term_access} ta ON ta.tid=t.tid AND ta.rid=tdg.rid
                       WHERE tdg.rid IN ('.implode(',',$rids).")
-                      GROUP BY t.tid HAVING BIT_OR(COALESCE(ta.grant_$op, td.grant_$op, tdg.grant_$op))");
+                      GROUP BY t.tid, t.vid HAVING BIT_OR(COALESCE(ta.grant_$op, td.grant_$op, tdg.grant_$op)) > 0");
       while ($result = db_fetch_object($sql)) {
         $tids[]= $result->tid;
         $vids[$result->vid]= $result->vid;
