diff --git a/nodewords.install b/nodewords.install
index 778953a..7fc10b2 100644
--- a/nodewords.install
+++ b/nodewords.install
@@ -1244,7 +1244,7 @@ function nodewords_update_6161(&$sandbox) {
 }
 
 /**
- * Implements hook_update_N().
+ * Convert the type and id columns to integers.
  */
 function nodewords_update_6162() {
   $ret = array();
@@ -1252,6 +1252,9 @@ function nodewords_update_6162() {
   db_drop_index($ret, 'nodewords', 'nodewords_type_id');
   db_drop_unique_key($ret, 'nodewords', 'nodewords_type_id_name');
 
+  // Ensure all empty strings are set to 0 before doing the type conversion.
+  db_query("UPDATE {nodewords} SET id = '0' WHERE id = '' OR id IS NULL");
+
   db_change_field($ret, 'nodewords', 'type', 'type',
     array(
       'type' => 'int',
@@ -1265,7 +1268,6 @@ function nodewords_update_6162() {
   db_change_field($ret, 'nodewords', 'id', 'id',
     array(
       'type' => 'int',
-      'size' => 'small',
       'unsigned' => TRUE,
       'not null' => TRUE,
       'default' => 0,
@@ -1342,6 +1344,44 @@ function nodewords_update_6167() {
 }
 
 /**
+ * Ensure that the table keys match the current schema.
+ *
+ * Update 6162 previously set the "id" column to a small int. This update is
+ * the same as 6162, but corrects the size fo the "id" column to be a normal
+ * integer for larger IDs.
+ */
+function nodewords_update_6168() {
+  db_drop_index($ret, 'nodewords', 'nodewords_type_id');
+  db_drop_unique_key($ret, 'nodewords', 'nodewords_type_id_name');
+
+  db_change_field($ret, 'nodewords', 'type', 'type',
+    array(
+      'type' => 'int',
+      'size' => 'small',
+      'unsigned' => TRUE,
+      'not null' => TRUE,
+      'default' => 0,
+    )
+  );
+
+  db_change_field($ret, 'nodewords', 'id', 'id',
+    array(
+      'type' => 'int',
+      'unsigned' => TRUE,
+      'not null' => TRUE,
+      'default' => 0,
+    )
+  );
+
+  db_add_index($ret, 'nodewords', 'nodewords_type_id',
+    array('type', 'id')
+  );
+  db_add_unique_key($ret, 'nodewords', 'nodewords_type_id_name',
+    array('type', 'id', 'name')
+  );
+}
+
+/**
  * Implements hook_uninstall().
  */
 function nodewords_uninstall() {
