diff --git a/includes/webform.conditionals.inc b/includes/webform.conditionals.inc
index 5604590..73cef4d 100644
--- a/includes/webform.conditionals.inc
+++ b/includes/webform.conditionals.inc
@@ -748,13 +748,13 @@ function webform_conditional_element_add($form, &$form_state) {
                       );
 
   if (empty($button['#subconditional'])) {
-    $new[0] = $parent_values[$rid]['source_type'] == 'component' ? $parent_values[$rid] : $default_rule;
+    $new[0] = (isset($parent_values[$rid]['source_type']) && ($parent_values[$rid]['source_type'] == 'component')) ? $parent_values[$rid] : $default_rule;
   }
   else {
     // The default andor operator is opposite of current subconditional's
     // operatior.
     $parent_rid = _webform_conditional_find_start($parent_values, $rid, -1);
-    $current_op = $parent_rid < 0 ? $conditional['andor'] : $parent_values[$parent_rid]['operator'];
+    $current_op = (isset($conditional['andor']) && $parent_rid < 0) ? $conditional['andor'] : $parent_values[$parent_rid]['operator'];
     $current_op = $current_op == 'and' ? 'or' : 'and';
     $new = array(
       array('source_type' => 'conditional_start', 'operator' => $current_op) + $default_rule,
@@ -787,13 +787,15 @@ function webform_conditional_element_remove($form, &$form_state) {
       $parent_values = &$parent_values[$key];
     }
   }
-  switch ($parent_values[$rid]['source_type']) {
-    case 'conditional_start':
-      unset($parent_values[_webform_conditional_find_end($parent_values, $rid)]);
-      break;
-    case 'conditional_end':
-      unset($parent_values[_webform_conditional_find_start($parent_values, $rid)]);
-      break;
+  if(isset($parent_values[$rid]['source_type'])) {
+    switch ($parent_values[$rid]['source_type']) {
+      case 'conditional_start':
+        unset($parent_values[_webform_conditional_find_end($parent_values, $rid)]);
+        break;
+      case 'conditional_end':
+        unset($parent_values[_webform_conditional_find_start($parent_values, $rid)]);
+        break;
+    }
   }
   // Remove this rule or action from the list of conditionals.
   unset($parent_values[$rid]);
