diff --git a/webform_pay.component.inc b/webform_pay.component.inc
index 2f61f4b..8e185b3 100644
--- a/webform_pay.component.inc
+++ b/webform_pay.component.inc
@@ -6,7 +6,7 @@
  */
 
 /**
- * Implementation of _webform_defaults_component().
+ * Implements _webform_defaults_component().
  */
 function _webform_defaults_pay() {
   return array(
@@ -39,7 +39,7 @@ function _webform_defaults_pay() {
 }
 
 /**
- * Implementation of _webform_theme_component().
+ * Implements _webform_theme_component().
  */
 function _webform_theme_pay() {
   return array(
@@ -50,7 +50,7 @@ function _webform_theme_pay() {
 }
 
 /**
- * Implementation of _webform_edit_component().
+ * Implements _webform_edit_component().
  */
 function _webform_edit_pay($component) {
   pay_load_handler('pay_form', 'pay_form');
@@ -207,7 +207,7 @@ function _webform_edit_pay($component) {
 }
 
 /**
- * Implementation of _webform_render_component().
+ * Implements _webform_render_component().
  */
 function _webform_render_pay($component, $value = NULL, $filter = TRUE) {
   // This is a merely a placeholder element, since pay forms need to be located
@@ -228,7 +228,7 @@ function _webform_render_pay($component, $value = NULL, $filter = TRUE) {
 }
 
 /**
- * Implementation of _webform_submit_component().
+ * Implements _webform_submit_component().
  */
 function _webform_submit_pay($component, $value) {
   if (isset($value['cc_type']) && isset($value['cc_number'])) {
@@ -254,7 +254,7 @@ function _webform_submit_pay($component, $value) {
 }
 
 /**
- * Implementation of _webform_display_component().
+ * Implements _webform_display_component().
  */
 function _webform_display_pay($component, $value, $format = 'html') {
   return array(
@@ -263,7 +263,7 @@ function _webform_display_pay($component, $value, $format = 'html') {
     '#theme' => 'webform_display_pay',
     '#theme_wrappers' => $format == 'html' ? array('webform_element') : array('webform_element_text'),
     '#post_render' => array('webform_element_wrapper'),
-    '#component' => $component,
+    '#webform_component' => $component,
     '#pmid' => $component['extra']['pmid'],
     '#format' => $format,
     '#value' => $value,
@@ -304,19 +304,19 @@ function theme_webform_display_pay($element) {
 }
 
 /**
- * Implementation of _webform_analysis_component().
+ * Implements _webform_analysis_component().
  */
 function _webform_analysis_pay($component, $sids = array()) {
+  $submissions = 0;
+  $payments = 0;
+  $payment_amount = 0;
+
   $placeholders = count($sids) ? array_fill(0, count($sids), "'%s'") : array();
   $sidfilter = count($sids) ? " AND sid in (" . implode(",", $placeholders) . ")" : "";
   $query = 'SELECT data' .
     ' FROM {webform_submitted_data}' .
     " WHERE nid = %d AND cid = %d AND no = 'total'" . $sidfilter;
 
-  $submissions = 0;
-  $payments = 0;
-  $payment_amount = 0;
-
   $result = db_query($query, array_merge(array($component['nid'], $component['cid']), $sids));
   while ($data = db_fetch_array($result)) {
     if ($data['data'] > 0) {
@@ -335,7 +335,7 @@ function _webform_analysis_pay($component, $sids = array()) {
 }
 
 /**
- * Implementation of _webform_table_component().
+ * Implements _webform_table_component().
  */
 function _webform_table_pay($component, $value) {
   $total = $value['total'] ? number_format($payment_amount / $payments, 2) : 0;
@@ -343,7 +343,7 @@ function _webform_table_pay($component, $value) {
 }
 
 /**
- * Implementation of _webform_csv_headers_component().
+ * Implements _webform_csv_headers_component().
  */
 function _webform_csv_headers_pay($component, $export_options) {
   $header = array();
@@ -362,7 +362,7 @@ function _webform_csv_headers_pay($component, $export_options) {
 }
 
 /**
- * Implementation of _webform_csv_data_component().
+ * Implements _webform_csv_data_component().
  */
 function _webform_csv_data_pay($component, $export_options, $value) {
   return array(
diff --git a/webform_pay.inc b/webform_pay.inc
index 2f0b4ef..309afa4 100644
--- a/webform_pay.inc
+++ b/webform_pay.inc
@@ -38,7 +38,9 @@ class webform_pay extends pay_form {
 
     // If there is no total value per payment method, set the global total.
     foreach ($values['pay_method']['selected'] as $pmid => $status) {
-      if (!$status) continue;
+      if (!$status) {
+        continue;
+      }
       $key = $this->handler();
 
       // Set the total value in the form state.
diff --git a/webform_pay.module b/webform_pay.module
index a9acfed..a83ae34 100644
--- a/webform_pay.module
+++ b/webform_pay.module
@@ -6,7 +6,7 @@
  */
 
 /**
- * Implementation of hook_webform_component_info().
+ * Implements hook_webform_component_info().
  */
 function webform_pay_webform_component_info() {
   $components = array();
@@ -24,7 +24,7 @@ function webform_pay_webform_component_info() {
 }
 
 /**
- * Implementation of hook_webform_component_info_alter().
+ * Implements hook_webform_component_info_alter().
  */
 function webform_pay_webform_component_info_alter(&$components) {
   // Allow components of these types to be used as a price field.
@@ -33,7 +33,7 @@ function webform_pay_webform_component_info_alter(&$components) {
 }
 
 /**
- * Implementation of hook_pay_form_handler_info().
+ * Implements hook_pay_form_handler_info().
  */
 function webform_pay_form_handler_info() {
   return array(
@@ -47,7 +47,7 @@ function webform_pay_form_handler_info() {
 }
 
 /**
- * Implementation of hook_webform_component_presave().
+ * Implements hook_webform_component_presave().
  */
 function webform_pay_webform_component_presave(&$component) {
   // Register a pay_form entry for this pay component.
@@ -68,9 +68,9 @@ function webform_pay_webform_component_presave(&$component) {
 }
 
 /**
- * Implementation of hook_webform_component_delete().
+ * Implements hook_webform_component_delete().
  */
-function webform_pay_webform_component_delete(&$component) {
+function webform_pay_webform_component_delete($component) {
   // Disable the matching pay_form entry for this pay component.
   if ($component['type'] == 'pay' && $component['extra']['pfid']) {
     if ($pay = pay_form_load($component['extra']['pfid'])) {
@@ -80,7 +80,7 @@ function webform_pay_webform_component_delete(&$component) {
 }
 
 /**
- * Implementation of hook_nodeapi().
+ * Implements hook_nodeapi().
  */
 function webform_pay_nodeapi(&$node, $op) {
   if (!in_array($node->type, webform_variable_get('webform_node_types'))) {
@@ -98,7 +98,7 @@ function webform_pay_nodeapi(&$node, $op) {
 }
 
 /**
- * Implementation of hook_node_load().
+ * Implements hook_node_load().
  */
 function webform_pay_node_load(&$node) {
   $additions = array();
@@ -107,11 +107,14 @@ function webform_pay_node_load(&$node) {
 }
 
 /**
- * Implementation of hook_form_alter().
+ * Implements hook_form_alter().
  */
 function webform_pay_form_alter(&$form, &$form_state, $form_id) {
   if (preg_match('/^webform_client_form_\d+$/', $form_id) && isset($form['#node']->webform_pay_cid)) {
     $node = $form['#node'];
+    if (empty($node->webform_pay_cid)) {
+      return;
+    }
     $pay_cid = $node->webform_pay_cid;
     $component = $node->webform['components'][$pay_cid];
 
