diff --git a/defaultcontent.module b/defaultcontent.module
index 62764bf..93e1e8e 100644
--- a/defaultcontent.module
+++ b/defaultcontent.module
@@ -352,7 +352,7 @@ function defaultcontent_import_sort($a, $b) {
   foreach ($plugins as $plugin) {
     $cb = isset($plugin['import_sort callback']) ? $plugin['import_sort callback'] : $plugin['name'] . '_import_sort';
     if (function_exists($cb)) {
-      $cmp = $cb($a, $b);
+      $cmp = $cb($a, $b) + $cmp;
     }
   }
   return $cmp;
diff --git a/plugins/menu_item.inc b/plugins/menu_item.inc
index 0ff53c9..39c5fa2 100644
--- a/plugins/menu_item.inc
+++ b/plugins/menu_item.inc
@@ -36,6 +36,21 @@ function menu_item_export_alter(&$node, &$export) {
 }
 
 /**
+ * Handles a sort to insure that parent menu links are imported first.
+ */
+function menu_item_import_sort($a, $b) {
+  if (!empty($a->link['has_children']) && empty($b->link['has_children'])) {
+    return -1;
+  }
+  elseif (!empty($b->link['has_children']) && empty($a->link['has_children'])) {
+    return 1;
+  }
+  else {
+    return 0;
+  }
+}
+
+/**
  * Handles the importing of menu item after the node is loaded
  *
  * Convert the menu item path from machine to nid and save
diff --git a/plugins/node_reference.inc b/plugins/node_reference.inc
index 89a89cb..e57bca5 100644
--- a/plugins/node_reference.inc
+++ b/plugins/node_reference.inc
@@ -87,10 +87,10 @@ function node_reference_import_sort($a, $b) {
       }
     }
   }
-  if (in_array($a->machine_name, $b_children) || empty($a_children)) {
+  if (in_array($a->machine_name, $b_children) && empty($a_children)) {
     return -1;
   }
-  elseif (in_array($b->machine_name, $a_children) || empty($b_children)) {
+  elseif (in_array($b->machine_name, $a_children) && empty($b_children)) {
     return 1;
   }
   else {
