diff --git a/domain_path.module b/domain_path.module
index 694bc28..987fcb8 100644
--- a/domain_path.module
+++ b/domain_path.module
@@ -182,10 +182,17 @@ function domain_path_form_node_form_alter(&$form, $form_state) {
     $default = '';
     // TODO: Only exposed checked domains?
     $form['domain_path'][$domain_id] = array(
+      '#type' => 'container',
+      '#access' => user_access('edit domain paths'),
+    );
+    $form['domain_path'][$domain_id]['alias'] = array(
       '#type' => 'textfield',
       '#title' => check_plain($domain['path']),
       '#default_value' => isset($paths[$domain_id]->alias) ? $paths[$domain_id]->alias : $default,
-      '#access' => user_access('edit domain paths'),
+    );
+    $form['domain_path'][$domain_id]['dpid'] = array(
+      '#type' => 'value',
+      '#value' => isset($paths[$domain_id]->dpid) ? $paths[$domain_id]->dpid : NULL,
     );
   }
 }
@@ -205,11 +212,11 @@ function domain_path_node_validate($node, $form, $form_state) {
   // Make sure we don't duplicate anything.
   foreach ($paths as $domain_id => $path) {
     $key = ($domain_id == -1) ? 0 : $domain_id;
-    if (!empty($path) && $path == $alias) {
+    if (!empty($path['alias']) && $path['alias'] == $alias) {
       form_set_error("domain_path][$key", t('Domain path may not match default path alias. You may leave the element blank.'));
       $set_message = TRUE;
     }
-    elseif (!empty($path)) {
+    elseif (!empty($path['alias'])) {
       $query = db_query("SELECT COUNT(dpid) FROM {domain_path} 
         WHERE domain_id = :domain_id 
         AND alias = :alias 
@@ -217,7 +224,7 @@ function domain_path_node_validate($node, $form, $form_state) {
         AND source != :source", 
         array(
           ':domain_id' => $key,
-          ':alias' => $path,
+          ':alias' => $path['alias'],
           ':language' => isset($node->language) ? $node->language : LANGUAGE_NONE,
           ':source' => "node/$node->nid",
         )
@@ -286,25 +293,42 @@ function domain_path_node_insert($node) {
   if (empty($node->domain_path)) {
     return;
   }
-  // Delete existing aliases.
-  domain_path_node_delete($node);
   // If not set to revert, then save changes.
   if (empty($node->domain_path['domain_path_ignore'])) {
     unset($node->domain_path['domain_path_ignore']);
     foreach ($node->domain_path as $domain_id => $path) {
-      if (!empty($path)) {
+      if (!empty($path['alias'])) {
+        // Save the {domain_path} record.
+        $primary_keys = array();
         $record = array(
           'domain_id' => $domain_id,
           'source' => "node/$node->nid",
-          'alias' => $path,
+          'alias' => $path['alias'],
           'language' => isset($node->language) ? $node->language : LANGUAGE_NONE,
           'entity_type' => 'node',
           'entity_id' => $node->nid,
         );
-        drupal_write_record('domain_path', $record);
+        if (!empty($path['dpid'])) {
+          // Update the existing record.
+          $record['dpid'] = $path['dpid'];
+          $primary_keys[] = 'dpid';
+        }
+        drupal_write_record('domain_path', $record, $primary_keys);
+      }
+      elseif (!empty($path['dpid'])) {
+        // Delete an existing alias record if alias value is empty.
+        db_delete('domain_path')
+          ->condition('entity_type', 'node')
+          ->condition('entity_id', $node->nid)
+          ->condition('dpid', $path['dpid'])
+          ->execute();
       }
     }
   }
+  else {
+    // Delete all existing aliases for the node.
+    domain_path_node_delete($node);
+  }
   // Rebuild the node alias.
   cache_clear_all('domain_path', 'cache');
   drupal_static_reset('domain_path_paths');
