diff --git a/hierarchical_select.module b/hierarchical_select.module
index b9ace69..f5556df 100644
--- a/hierarchical_select.module
+++ b/hierarchical_select.module
@@ -556,57 +556,65 @@ function _hs_process_exclusive_lineages($element, $hs_selection, $db_selection)
 
 function _hs_process_render_create_new_item($element, $hierarchy) {
   $creating_new_item = FALSE;
-  if (isset($element['#value']['hierarchical_select']['selects'])) {
-    foreach ($element['#value']['hierarchical_select']['selects'] as $depth => $value) {
-      if ($value == 'create_new_item' && _hierarchical_select_create_new_item_is_allowed($config, $depth)) {
-        $creating_new_item = TRUE;
-
-        // We want to override the select in which the "create_new_item"
-        // option was selected and hide all selects after that, if they exist.
-        // If depth == 0, then that means all selects should be hidden.
-        if ($depth == 0) {
-          unset($element['hierarchical_select']['selects']);
-        }
-        else {
-          for ($i = $depth; $i < count($hierarchy->lineage); $i++) {
-            unset($element['hierarchical_select']['selects'][$i]);
-          }
+  $selects = array();
+
+  // $element['#value'] can be a string, so we need to protect against
+  // PHP using string indexing when we want array indexing.
+  if (!empty($element['#value']) && is_array($element['#value'])) {
+    if (isset($element['#value']['hierarchical_select']['selects'])) {
+      $selects = $element['#value']['hierarchical_select']['selects'];
+    }
+  }
+
+  foreach ($selects as $depth => $value) {
+    if ($value == 'create_new_item' && _hierarchical_select_create_new_item_is_allowed($config, $depth)) {
+      $creating_new_item = TRUE;
+
+      // We want to override the select in which the "create_new_item"
+      // option was selected and hide all selects after that, if they exist.
+      // If depth == 0, then that means all selects should be hidden.
+      if ($depth == 0) {
+        unset($element['hierarchical_select']['selects']);
+      }
+      else {
+        for ($i = $depth; $i < count($hierarchy->lineage); $i++) {
+          unset($element['hierarchical_select']['selects'][$i]);
         }
+      }
 
-        $element['hierarchical_select']['create_new_item'] = array(
-          '#prefix' => '<div class="create-new-item">',
-          '#suffix' => '</div>',
-        );
+      $element['hierarchical_select']['create_new_item'] = array(
+        '#prefix' => '<div class="create-new-item">',
+        '#suffix' => '</div>',
+      );
 
-        $item_type_depth = ($value == 'create_new_item') ? $depth : $depth + 1;
-        $item_type = (!empty($config['editability']['item_types'][$item_type_depth])) ? t($config['editability']['item_types'][$item_type_depth]) : t('item');
-
-        $element['hierarchical_select']['create_new_item']['input'] = array(
-          '#type' => 'textfield',
-          '#size' => 20,
-          '#maxlength' => 255,
-          '#default_value' => t('new @item', array('@item' => $item_type)),
-          '#attributes' => array(
-            'title' => t('new @item', array('@item' => $item_type)),
-            'class' => array('create-new-item-input'),
-          ),
-          // Prevent the textfield from being wrapped in a div. This
-          // simplifies the CSS and JS code.
-          '#theme_wrappers' => array(),
-        );
+      $item_type_depth = ($value == 'create_new_item') ? $depth : $depth + 1;
+      $item_type = (!empty($config['editability']['item_types'][$item_type_depth])) ? t($config['editability']['item_types'][$item_type_depth]) : t('item');
+
+      $element['hierarchical_select']['create_new_item']['input'] = array(
+        '#type' => 'textfield',
+        '#size' => 20,
+        '#maxlength' => 255,
+        '#default_value' => t('new @item', array('@item' => $item_type)),
+        '#attributes' => array(
+          'title' => t('new @item', array('@item' => $item_type)),
+          'class' => array('create-new-item-input'),
+        ),
+        // Prevent the textfield from being wrapped in a div. This
+        // simplifies the CSS and JS code.
+        '#theme_wrappers' => array(),
+      );
 
-        $element['hierarchical_select']['create_new_item']['create'] = array(
-          '#type' => 'button',
-          '#value' => t('Create'),
-          '#attributes' => array('class' => array('create-new-item-create')),
-        );
+      $element['hierarchical_select']['create_new_item']['create'] = array(
+        '#type' => 'button',
+        '#value' => t('Create'),
+        '#attributes' => array('class' => array('create-new-item-create')),
+      );
 
-        $element['hierarchical_select']['create_new_item']['cancel'] = array(
-          '#type' => 'button',
-          '#value' => t('Cancel'),
-          '#attributes' => array('class' => array('create-new-item-cancel')),
-        );
-      }
+      $element['hierarchical_select']['create_new_item']['cancel'] = array(
+        '#type' => 'button',
+        '#value' => t('Cancel'),
+        '#attributes' => array('class' => array('create-new-item-cancel')),
+      );
     }
   }
 
