diff --git a/includes/webform.submissions.inc b/includes/webform.submissions.inc
index e3a656e..dccf12d 100644
--- a/includes/webform.submissions.inc
+++ b/includes/webform.submissions.inc
@@ -521,7 +521,7 @@ function webform_submission_resend($form, $form_state, $node, $submission) {
     $addresses = webform_format_email_address($email['email'], NULL, $node, $submission, FALSE, FALSE, NULL, $mapping);
     $addresses_valid = array_map('webform_valid_email_address', $addresses);
     $valid_email = count($addresses) == array_sum($addresses_valid);
-    
+
     $form['resend'][$eid] = array(
       '#type' => 'checkbox',
       '#default_value' => $valid_email && $email['status'],
@@ -636,22 +636,18 @@ function webform_submission_render($node, $submission, $email, $format, $exclude
   $renderable['#theme'] = array('webform_submission_' . $node->nid, 'webform_submission');
 
   $components = $node->webform['components'];
-  
+
   // Remove excluded components.
   if (is_array($excluded_components)) {
     foreach ($excluded_components as $cid) {
       unset($components[$cid]);
     }
-    if ($email && $email['exclude_empty']) {
+    if (!empty($email['exclude_empty'])) {
       foreach ($submission->data as $cid => $data) {
         // Caution. Grids store their data in an array index by question key.
-        foreach ($data as $value) {
-          if ($value != '') {
-            // This component has a non-empty value. Continue the outer loop.
-            continue 2;
-          }
+        if (implode($data) == '') {
+          unset($components[$cid]);
         }
-        unset($components[$cid]);
       }
     }
   }
