diff --git webform_conditional.module webform_conditional.module
index 8ea317f..7e789df 100644
--- webform_conditional.module
+++ webform_conditional.module
@@ -30,7 +30,7 @@ function webform_conditional_form_webform_component_edit_form_alter(&$form, &$fo
           if ($row = $result->fetchAssoc()) {
             //not dealing with a new component
             $extra = unserialize($row['extra']);
-            $default_value =  trim($extra['webform_conditional_field_value']);
+            $default_value =  trim(isset($extra['webform_conditional_field_value']) ? $extra['webform_conditional_field_value'] : '');
             //don't check for empty b/c 0 could only value
             if ($default_value !== '') {
               //has existing value from this module
@@ -41,7 +41,6 @@ function webform_conditional_form_webform_component_edit_form_alter(&$form, &$fo
           }
         }
       }
-
     }
   }
 }
@@ -101,9 +100,9 @@ function webform_conditional_form_alter(&$form, $form_state, $form_id) {
       //see if field is on this page
       $extra = NULL;
       if ($field = _webform_conditional_get_field($form['submitted'], $row['cid']) && !isset($js_fields[$row['form_key']])) {
-        $extra = unserialize( $row['extra']);
+        $extra = unserialize($row['extra']);
         $row['extra'] = $extra;
-        if ($extra['webform_conditional_cid']) {
+        if (isset($extra['webform_conditional_cid']) && $extra['webform_conditional_cid']) {
           if (!_webform_conditional_get_field($form['submitted'], $extra['webform_conditional_cid'])) {
             //watchdog('webform_conditional', "Error webform, nid=$nid.  The field {$row['form_key']} was not hidden because it's dependent field {$extra['webform_conditional_field_key']} was not on the form.", NULL, WATCHDOG_WARNING);
             continue;
@@ -118,7 +117,7 @@ function webform_conditional_form_alter(&$form, $form_state, $form_id) {
             'monitor_cid' => $extra['webform_conditional_cid'],
             'monitor_field_key' => $rows[$extra['webform_conditional_cid']]['form_key'],
             'monitor_field_value' => $monitor_field_values,
-            'monitor_field_trigger' => $extra['webform_conditional_trigger'],
+            'monitor_field_trigger' => isset($extra['webform_conditional_trigger']) ? $extra['webform_conditional_trigger'] : '',
             'operator' => isset($extra['webform_conditional_operator']) ? $extra['webform_conditional_operator'] : "=",
             'default_value' => $row['value'],
             'css_id' => _webform_conditional_get_css_id($form['details']['nid']['#value'], $row['cid']),
@@ -169,7 +168,7 @@ function _webform_condtional_component_is_conditional($component, $nid) {
   static $form_components;
   if (empty($form_components[$nid])) {
     //possible to have more than on webform on a page so store with nid
-    $form_components[$nid] = _webform_conditional_get_all_components($nid, $submitted_data);
+    $form_components[$nid] = _webform_conditional_get_all_components($nid, array());
   }
   if (!empty($component['extra']['webform_conditional_cid'])) {
     //this element doesn't have a direct trigger and is not within a fieldset
@@ -401,29 +400,41 @@ function _webform_conditional_was_hidden($cid, $components) {
   //can be hidden 1 of 3 ways
   return $this_hidden || $trigger_hidden || $fieldset_hidden;
 }
+/**
+ * @return The types of elements that should be used as a conditional trigger.
+ */
+function webform_conditional_trigger_types() {
+  $types = array('select','pagebreak','fieldset');
+  drupal_alter('webform_conditional_trigger_types', $types);
+  return $types;
+}
 /*
  * select all the components this component could be dependent on
  * for now this is limited to single select
  */
 function _webform_conditional_possible_trigger_components($nid, $cid, $return_groups = TRUE) {
   $new_component = empty($cid);
+  $trigger_types = webform_conditional_trigger_types();
   //** all a fieldset can't be dependent on a field contained in itself(check pid)
+  $query = db_select('webform_component', 'w')
+    ->fields('w', array('name', 'form_key', 'type', 'extra', 'cid', 'weight', 'pid'))
+    ->condition('nid', $nid)
+    ->orderBy('weight', 'ASC');
   if (!$new_component) {
     $baseComponent = _webform_conditional_get_base_component($nid, $cid);
-    $sql = "SELECT name, form_key, type, extra,cid, weight,pid FROM {webform_component} WHERE nid = :nid and pid <> :pid and (type in ('select','pagebreak','fieldset') OR cid = :cid) order by weight ASC ";
-    $sql_args = array(
-      ':nid' => $nid,
-      ':pid' => $cid,
-      ':cid' => $cid,
-    );
+    $query->condition('pid', $cid, '<>');
+    // Add or condition
+    $or = db_or()
+      ->condition('type', $trigger_types)
+      ->condition('cid', $cid);
+    $query->condition($or);
   }
   else {
     $baseComponent['cid'] = '';
-    $sql = "SELECT name, form_key, type, extra,cid, weight,pid FROM {webform_component} WHERE nid = :nid  and type in ('select','pagebreak','fieldset') order by weight ASC ";
-    $sql_args = array(':nid' => $nid);
+    $query->condition('type', $trigger_types);
   }
 
-  $result = db_query($sql, $sql_args);
+  $result = $query->execute();
   $fieldOptions[''] = "";
   $currPageNum = 1;
   $prePageBreakWeight = -999999999999;
@@ -484,7 +495,6 @@ function _webform_conditional_possible_trigger_components($nid, $cid, $return_gr
     }
   }
   if (!empty($components)) {
-
     return $components;
   }
   else {
