diff --git a/taxonomy_menu.admin.inc b/taxonomy_menu.admin.inc
index 6f88eab..58b8866 100644
--- a/taxonomy_menu.admin.inc
+++ b/taxonomy_menu.admin.inc
@@ -181,10 +181,10 @@ function taxonomy_menu_form_taxonomy_form_vocabulary(&$form, &$form_state) {
  */
 function taxonomy_menu_vocab_submit($form, &$form_state) {
   // Initialize flag variables for updating/rebuilding the taxonomy menu.
+  $rebuild = FALSE;
   $update = FALSE;
   $insert = FALSE;
 
-  $menu_disabled = $form_state['values']['taxonomy_menu']['vocab_parent'] == '0';
   $vid = $form_state['values']['vid'];
   // Flatten array of submitted settings so we can save them more easily.
   $flatten_settings = _taxonomy_menu_flatten_form_settings($form_state['values']['taxonomy_menu']);
@@ -194,47 +194,54 @@ function taxonomy_menu_vocab_submit($form, &$form_state) {
   $vocab_parent =  $flatten_settings['vocab_parent'];
   $menu_location = ($vocab_parent == '0') ? '0:0' : $vocab_parent;
   list($flatten_settings['vocab_menu'], $flatten_settings['vocab_parent']) = explode(':', $menu_location);
+  $vocab_menu =  $flatten_settings['vocab_menu'];
+
+  $old_vocab_parent = taxonomy_menu_variable_get('vocab_parent', $vid, '0');
+  $old_vocab_menu = taxonomy_menu_variable_get('vocab_menu', $vid, '0');
+  $old_menu_location = $old_vocab_menu . ':' . $old_vocab_parent;
+
+  $menu_changed = ($menu_location != $old_menu_location);
+  $menu_disabled = $form_state['values']['taxonomy_menu']['vocab_parent'] == '0';
+
+  // If vocabulary is and was not activated, skip all processing.
+  if ($menu_location != '0:0' || $old_menu_location != '0:0') {
+    // Check if the user explicitly wants to rebuild the menu. Do not save this setting.
+    $rebuild = $flatten_settings['rebuild'];
+    unset($flatten_settings['rebuild']);
 
-  // Get all the settings that have changed since the last submit. If some of
-  // them have changed, then update the taxonomy menu.
-  $changed_settings = array();
-  if ($vid != 0) {
     $changed_settings = _taxonomy_menu_get_changed_settings($flatten_settings, $vid);
-    if (!empty($changed_settings)) {
+    // Options have changed, save/update the menu.
+    // Do a full menu rebuild in case we have removed or moved the menu.
+    if ($menu_disabled) {
+      // Menu was disabled, delete all existing menu links.
+      taxonomy_menu_menu_links_delete($vid);
       $update = TRUE;
-      // Options have changed, save/update the menu.
-      $menu_change = in_array('vocab_parent', $changed_settings) || in_array('vocab_menu', $changed_settings);
-      if ($menu_change) {
-        // Menu location has changed.
-        if ($menu_disabled) {
-          // Menu was disabled, delete all existing menu links.
-          taxonomy_menu_menu_links_delete($vid);
-        }
-        else {
-          // Menu location has been changed and is not disabled.
-          $old_vocab_parent = taxonomy_menu_variable_get('vocab_parent', $vid, '0');
-          $old_vocab_menu = taxonomy_menu_variable_get('vocab_menu', $vid, '0');
-          if ($old_vocab_menu == '0' && $old_vocab_parent == '0') {
-            // Menu was disabled before, create new links.
-            $insert = TRUE;
-          }
-        }
-        // Do a full menu rebuild in case we have removed or moved the menu.
-        variable_set('menu_rebuild_needed', TRUE);
-      }
+      variable_set('menu_rebuild_needed', TRUE);
     }
-    elseif (!$flatten_settings['rebuild']) {
+    elseif ($menu_changed) {
+      // Menu location has been changed and is not disabled.
+      $update = TRUE;
+      $insert = TRUE;
+      variable_set('menu_rebuild_needed', TRUE);
+    }
+    elseif (!empty($changed_settings)) {
+      // Menu location did not change, but some settings have.
+      $update = TRUE;
+    }
+    elseif (!$rebuild) {
       // Display a notification message. Nothing to update.
       drupal_set_message(t('The Taxonomy menu was not updated. Nothing to update.'), 'status');
     }
-  }
 
-  // Save all the submitted values.
-  _taxonomy_menu_save_form_settings($flatten_settings, $vid);
+    if ($update) {
+      // Save all the submitted values.
+      _taxonomy_menu_save_form_settings($flatten_settings, $vid);
+    }
+  }
 
   // We don't need to check for the disabled menu location because the rebuild
   // function will delete the taxonomy menu in all cases.
-  if ($flatten_settings['rebuild']) {
+  if ($rebuild) {
     taxonomy_menu_rebuild($vid);
   }
   elseif ($insert) {
@@ -308,23 +315,24 @@ function taxonomy_menu_get_vocabulary_settings() {
  * Implements hook_taxonomy_menu_vocabulary_settings()
  */
 function taxonomy_menu_taxonomy_menu_vocabulary_settings() {
+  // Make sure the values are consistent with an empty submitted form.
   $defaults = array(
     'vocab_parent' => 0,
     'vocab_menu' => 0,
     'path' => 0,
-    'sync' => TRUE,
-    'rebuild' => FALSE,
-    'expanded' => TRUE,
-    'term_item_description' => FALSE,
-    'display_num' => FALSE,
-    'hide_empty_terms' => FALSE,
-    'flat' => FALSE,
-    'voc_item_description' => FALSE,
-    'voc_item' => FALSE,
+    'sync' => 1,
+    'rebuild' => 0,
+    'expanded' => 1,
+    'term_item_description' => 0,
+    'display_num' => 0,
+    'hide_empty_terms' => 0,
+    'flat' => 0,
+    'voc_item_description' => 0,
+    'voc_item' => 0,
     'voc_name' => '',
     //'display_descendants' => FALSE,
     'end_all' => FALSE,
-    'display_title_attr' => FALSE,
+    'display_title_attr' => 0,
   );
 
   return $defaults;
