--- webform.module-5.x-2.0.fixed	2008-06-04 15:43:16.000000000 -0600
+++ webform.module-5.x-2.0.broken	2008-06-04 15:33:04.000000000 -0600
@@ -1285,13 +1285,6 @@
     }
     return;
   }
-  if (!is_array($form_values['submitted'])) { $form_values['submitted'] = array(); }
-
-  foreach ($node->webform['components'] as $cid => $component) {
-    if ($component['type'] == "fieldset") {
-      $form_values['submitted'][$component['form_key']] = array();
-    }
-  }
 
   if (is_array($_SESSION[$session_key])) {
     // Merge any submission data stored in $_SESSION for multistep forms.
@@ -1483,12 +1476,6 @@
   if (is_array($form_values)) {
     foreach ($form_values as $form_key => $value) {
       $cid = webform_get_cid($node, $form_key, $parent);
-      while ($cid == NULL) {
-        $parent += 1;
-        $cid = webform_get_cid($node, $form_key, $parent);
-      }
-      $parent = 0;
-
       if (is_array($value) && $node->webform['components'][$cid]['type'] == 'fieldset') {
         _webform_client_form_submit_process($node, $form_values[$form_key], $cid);
       }
@@ -1514,12 +1501,6 @@
   if (is_array($fieldset)) {
     foreach ($fieldset as $form_key => $value) {
       $cid = webform_get_cid($node, $form_key, $parent);
-      // Keep trying to find the CID within nested fieldsets.
-      while ($cid == NULL) {
-        $parent += 1;
-        $cid = webform_get_cid($node, $form_key, $parent);
-      }
-      $parent = 0;
 
       if (is_array($value) && $node->webform['components'][$cid]['type'] == 'fieldset') {
         _webform_client_form_submit_flatten($node, $value, $form, $cid);
@@ -1653,7 +1634,7 @@
     $message .= $indent . $node->webform['components'][$cid]['name'] .":\n";
     foreach ($value as $k => $v) {
       foreach ($node->webform['components'] as $local_key => $local_value) {
-        if ($local_value['form_key'] == $k) {
+        if ($local_value['form_key'] == $k && $local_value['pid'] == $cid) {
           $form_key = $local_key;
           break;
         }
