diff --git a/nodeorder.install b/nodeorder.install
index ac6dc43..ef8a9d3 100644
--- a/nodeorder.install
+++ b/nodeorder.install
@@ -8,7 +8,7 @@
  */
 function nodeorder_install() {
   $module_name = 'nodeorder';
-  
+
   // Set field properties
   $spec =  array(
     'type' => 'int',
@@ -25,19 +25,26 @@ function nodeorder_install() {
   // Add the column to the table
   $ret = array();
   db_add_field($ret, 'term_node', 'weight_in_tid', $spec, $keys);
-  
-  if ($ret['success'] === TRUE) {
-  	// Set the weight of the nodeorder module in the system table
+
+  // Check for query errors
+  for ($i = 0; $i < count($ret); $i++) {
+    if ($ret[$i]['success'] !== TRUE) {
+      $installation_failed = TRUE;
+    }
+  }
+
+  if ($installation_failed) {
+    drupal_set_message(t('Table installation for the %name module was unsuccessful. The tables may need to be installed by hand.  See %name.install file for a list of the installation queries.', array('%name' => $module_name)), 'error');
+  }
+  else {
+    // Set the weight of the nodeorder module in the system table
     // so that we come after most other modules in module_invoke_all()
     // calls.  This ensures that we can alter forms after, for instance,
     // the taxonomy module...
     db_query("UPDATE {system} SET weight = 5 WHERE name = 'nodeorder' AND type = 'module'");
-    
+
     drupal_set_message(t('The %name module installed successfully.', array('%name' => $module_name)));
   }
-  else {
-    drupal_set_message(t('Table installation for the %name module was unsuccessful. The tables may need to be installed by hand.  See %name.install file for a list of the installation queries.', array('%name' => $module_name)), 'error');
-  }
 }
 
 /**
@@ -50,13 +57,20 @@ function nodeorder_uninstall() {
 
   $ret = array();
   db_drop_field($ret, 'term_node', 'weight_in_tid');
-  
-  if ($ret['success'] === TRUE) {
-    drupal_set_message(t('The %name module uninstalled successfully.', array('%name' => $module_name)));
+
+  // Check for query errors
+  for ($i = 0; $i < count($ret); $i++) {
+    if ($ret[$i]['success'] !== TRUE) {
+      $uninstallation_failed = TRUE;
+    }
   }
-  else {
+
+  if ($uninstallation_failed) {
     drupal_set_message(t('Table uninstallation for the %name module was unsuccessful. The tables may need to be installed by hand.  See %name.install file for a list of the installation queries.', array('%name' => $module_name)), 'error');
   }
+  else {
+    drupal_set_message(t('The %name module uninstalled successfully.', array('%name' => $module_name)));
+  }
 }
 
 /**
