--- og_vocab.module.old	2006-05-13 03:23:24.000000000 +0100
+++ og_vocab.module	2006-06-23 14:36:59.037679200 +0100
@@ -89,13 +89,15 @@ function og_vocab_menu($may_cache) {
 function og_vocab_form_alter($form_id, &$form) {
   switch ($form_id) {
     case 'taxonomy_form_vocabulary':
-      $form['module'] = array('#type' => 'value', '#value' => 'og_vocab');
-      $form['og'] = array('#type' => 'value', '#value' => arg(1));
+	  if (is_numeric(arg(1))) {
+        $form['module'] = array('#type' => 'value', '#value' => 'og_vocab');
+        $form['og'] = array('#type' => 'value', '#value' => arg(1));
       
-      $omit = array_merge(variable_get('og_node_types', array('og')), variable_get('og_omitted', array()));
-      foreach ($omit as $type) {
-        unset($form['nodes']['#options'][$type]);
-      }
+        $omit = array_merge(variable_get('og_node_types', array('og')), variable_get('og_omitted', array()));
+        foreach ($omit as $type) {
+          unset($form['nodes']['#options'][$type]);
+        }
+	  }
       break;
     case (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id):
       // remove from node form those vocabs that belong to other groups
@@ -103,18 +105,28 @@ function og_vocab_form_alter($form_id, &
         $where = "(v.module = 'og_vocab' AND ov.nid != %d)";
         $sql = "SELECT v.vid FROM {vocabulary} v INNER JOIN {og_vocab} ov ON v.vid = ov.vid WHERE $where";
         $result = db_query($sql, $groupnode->nid);
-        while ($row = db_fetch_object($result)) {
-          unset($form['taxonomy'][$row->vid]);
-        }
-        // remove categories fieldset if no vocabularies remain
-        $empty = TRUE;
+	  } else {
+	    $where = "v.module = 'og_vocab'";
+        $sql = "SELECT v.vid FROM {vocabulary} v WHERE $where";
+        $result = db_query($sql);
+	  }
+        
+	  while ($row = db_fetch_object($result)) {
+        unset($form['taxonomy'][$row->vid]);
+      }
+      // remove categories fieldset if no vocabularies remain
+        
+	  if ($form['taxonomy']) {
         $keys = array_keys($form['taxonomy']);
-        foreach ($keys as $key) {
-          if (is_numeric($key)) {
-            $empty = FALSE;
-            break;
+		if ($keys) {
+		  $empty = TRUE;
+          foreach ($keys as $key) {
+            if (is_numeric($key)) {
+              $empty = FALSE;
+              break;
+            }
           }
-        }
+		}
         if ($empty) {
           unset($form['taxonomy']);
         }
@@ -150,9 +162,6 @@ function og_vocab_taxonomy($op, $type, $
  */
 function og_vocab_overview_vocabularies($gid) {
   $groupnode = node_load((int)$gid);
-  drupal_set_title($groupnode->title);
-  $bc = array(l(t('home'), ''), l(t('groups'), 'og'));
-  drupal_set_breadcrumb($bc);
   $links[] = l(t('add vocabulary'), "node/$gid/og/vocab/add/vocabulary", array(), drupal_get_destination());
   $output = theme('item_list', $links);
   $vocabularies = og_vocab_load_vocabularies($gid);
