diff --git a/webform_conditional.module b/webform_conditional.module
index e123879..5d6675e 100644
--- a/webform_conditional.module
+++ b/webform_conditional.module
@@ -130,18 +130,16 @@ function webform_conditional_form_alter(&$form, $form_state, $form_id) {
       }
     }
   }
-  if (!empty($js_fields)) {
-    //can't add javascript in this function or it will not be added if the form is built from cache.  Need to run "after_build" function
-    $form['#after_build'][] = 'webform_conditional_add_js';
-    $js_settings = array(
-      'fields' => $js_fields,
-      'nid' => $nid,
-      'showSpeed' => NULL, //'fast',
-    );
-    //store JavaScript variable for the webform_conditional_add_js function
-    $form['#webform_conditional_js'] =    $js_settings;
-
-  }
+  //can't add javascript in this function or it will not be added if the form is built from cache.  Need to run "after_build" function
+  $form['#after_build'][] = 'webform_conditional_add_js';
+  $js_settings = array(
+    // Rewrite previous settings if the form is being rebuilt.
+    'fields' => isset($js_fields) ? $js_fields : FALSE,
+    'nid' => $nid,
+    'showSpeed' => NULL, //'fast',
+  );
+  //store JavaScript variable for the webform_conditional_add_js function
+  $form['#webform_conditional_js'] = $js_settings;
 }
 /**
  * This function is attached to all conditonal elements that are also required
