--- workspace.module.37	2009-07-21 19:19:10.000000000 +0100
+++ workspace.module	2009-07-21 19:56:56.000000000 +0100
@@ -198,7 +198,7 @@
   }
   if ( module_exists('comment') ) {
     if (!is_numeric($form_state['values']['maxcomments']) && !form_get_errors()) {
-      form_set_error('maxfilenames', t('Please enter a numeric value.'));
+      form_set_error('maxcomments', t('Please enter a numeric value.'));
     }
   }
 }
@@ -216,6 +216,9 @@
   }
   $account->workspaces['default']['maxnodes'] = (int)$form_state['values']['maxnodes'];
   $account->workspaces['default']['maxfilenames'] = (int)$form_state['values']['maxfilenames'];
+  if ( module_exists('comment') ) {
+    $account->workspaces['default']['maxcomments'] = (int)$form_state['values']['maxcomments'];
+  }
   user_save($account, array('workspaces' => $account->workspaces));
   drupal_set_message(t('The workspace preferences have been saved.'));
   $form_state['redirect'] = 'workspace/'. $form_state['values']['uid'];
@@ -242,6 +245,15 @@
             FROM {node} n
             LEFT JOIN {node_comment_statistics} s ON n.nid = s.nid
             WHERE n.uid = %d';
+    $header = array(
+      array('data' => t('Type'), 'field' => 'type'),
+      array('data' => t('Title'), 'field' => 'title'),
+      array('data' => t('Owner'), 'field' => 'uid'),
+      array('data' => t('Published'), 'field' => 'status'),
+      array('data' => t('Modified'), 'field' => 'changed', 'sort' => 'desc'),
+      array('data' => t('Replies'), 'field' => 'comment_count'),
+      array('data' => t('Operations'), 'colspan' => 2)
+    );
   }
   else {
     // Otherwise we use a simpler query.
@@ -251,17 +263,16 @@
     $count_sql = 'SELECT COUNT(n.nid)
             FROM {node} n
             WHERE n.uid = %d';
-  }
-
   $header = array(
     array('data' => t('Type'), 'field' => 'type'),
     array('data' => t('Title'), 'field' => 'title'),
     array('data' => t('Owner'), 'field' => 'uid'),
     array('data' => t('Published'), 'field' => 'status'),
     array('data' => t('Modified'), 'field' => 'changed', 'sort' => 'desc'),
-    $comments_enabled ? array('data' => t('Replies'), 'field' => 'comment_count') : array('data' => ''),
     array('data' => t('Operations'), 'colspan' => 2)
   );
+  }
+
   $cols = 8;
   $result = pager_query(db_rewrite_sql($sql . tablesort_sql($header)), $max, 0, db_rewrite_sql($count_sql), $account->uid);
   $rows = workspace_build_rows($result, $account);
@@ -271,7 +282,7 @@
     $output = drupal_get_form('workspace_add_form');
   }
 
-  $output .= theme_workspace_list($header, $rows, $max, $cols);
+  $output .= theme('workspace_list', $header, $rows, $max, $cols);
   return $output;
 }
 
@@ -302,7 +313,7 @@
   $cols = 6;
   $result = pager_query($sql . tablesort_sql($header), $max, 0, $count_sql, $account->uid);
   $rows = workspace_build_rows($result, $account);
-  return theme_workspace_list($header, $rows, $max, $cols);
+  return theme('workspace_list', $header, $rows, $max, $cols);
 }
 
 /**
