diff --git a/nodehierarchy.module b/nodehierarchy.module
index 57ddea9..dc8b6d2 100644
--- a/nodehierarchy.module
+++ b/nodehierarchy.module
@@ -582,7 +582,7 @@ function _nodehierarchy_node_parent_form_items($node, $key, $menu_link) {
   foreach ($menu_link as $i => $value) {
     $item[$i] = array(
       '#type' => 'value',
-      '#value' => $value,
+      '#default_value' => $value,
     );
   }
 
@@ -1500,7 +1500,7 @@ function _nodehierarchy_get_parent_selector($child_type, $parent, $exclude = NUL
   }
 
   // Make sure the current value is enabled so items can be resaved.
-  $items[$default_value]['disabled'] = FALSE;
+  $items[$default_value]['disabled'] = 0;
 
   $out = array(
     '#type' => 'select',
@@ -1552,12 +1552,13 @@ function theme_nodehierarchy_parent_selector($variables) {
  * Validate the parent node selector to make sure the parent is legal.
  */
 function nodehierarchy_parent_selector_validate($element, &$form_state) {
-  $selection = $element['#items'][$element['#value']];
+  $selection = @$element['#items'][$element['#value']];
   if (is_array($selection) && !empty($selection['disabled'])) {
     form_error($element, t('You have selected a parent node which cannot be a parent of this node type.'));
-  }
-  if (is_array($selection) && !empty($form_state['values']['nid']) && in_array($form_state['values']['nid'], nodehierarchy_get_node_ancestor_nids($selection['nid']))) {
-    form_error($element, t('The parent of this node can not be itself or any if its decendants.'));
+
+	if (in_array($form_state['values']['nid'], nodehierarchy_get_node_ancestor_nids($selection['nid']))) {
+		form_error($element, t('The parent of this node can not be itself or any if its decendants.'));
+	}
   }
 }
 
