diff --git a/tablefield.module b/tablefield.module
index be4a32a..c4a0f57 100644
--- a/tablefield.module
+++ b/tablefield.module
@@ -519,7 +519,13 @@ function tablefield_field_is_empty($item, $field) {
     return FALSE;
   }
 
-  $count_rows = $item['tablefield']['rebuild']['count_rows'];
+  $count_rows = 0;
+  if (isset($item['tablefield']['rebuild'])) {
+    $count_rows = $item['tablefield']['rebuild']['count_rows'];
+  }
+  else {
+    $count_rows = count($item['tablefield']['tabledata']);
+  }
   // Remove the preference fields to see if the table cells are all empty.
   unset($item['tablefield']['caption']);
   unset($item['tablefield']['rebuild']);
