diff --git a/sites/all/modules/tableofcontents/tableofcontents.pages.inc b/sites/all/modules/tableofcontents/tableofcontents.pages.inc
index 55550fa..0deab45 100644
--- a/sites/all/modules/tableofcontents/tableofcontents.pages.inc
+++ b/sites/all/modules/tableofcontents/tableofcontents.pages.inc
@@ -632,6 +632,11 @@ function _tableofcontents_replace_toc($text, $format, $filter) {
     return _tableofcontents_headers($_tableofcontents_toc, $format, $text);
   }
 
+  // fix this bug :(
+  if (is_object($format)) {
+    return preg_replace(TABLEOFCONTENTS_REMOVE_PATTERN, '', $text);
+  }
+
   // if the user just asked to hide that, hide it and go away
   if (variable_get('tableofcontents_hide_table_' . $format, FALSE)) {
     return preg_replace(TABLEOFCONTENTS_REMOVE_PATTERN, '', $text);
