diff --git a/templates/system/table.func.php b/templates/system/table.func.php
index c772207..93b9b9d 100644
--- a/templates/system/table.func.php
+++ b/templates/system/table.func.php
@@ -120,10 +120,6 @@ function bootstrap_table($variables) {
 
   $output = '';
 
-  if ($responsive) {
-    $output .= "<div class=\"table-responsive\">\n";
-  }
-
   $output .= '<table' . drupal_attributes($attributes) . ">\n";
 
   if (isset($caption)) {
@@ -268,8 +264,8 @@ function bootstrap_table($variables) {
 
   $output .= "</table>\n";
 
-  if ($responsive) {
-    $output .= "</div>\n";
+  if (isset($responsive) && $responsive) {
+    return '<div class="table-responsive">' . $output . '</div>';
   }
 
   return $output;
diff --git a/templates/views/views-view-table.tpl.php b/templates/views/views-view-table.tpl.php
index 8721359..5ef7079 100644
--- a/templates/views/views-view-table.tpl.php
+++ b/templates/views/views-view-table.tpl.php
@@ -20,7 +20,7 @@
  * @ingroup templates
  */
 ?>
-<?php if ($responsive): ?>
+<?php if (isset($responsive) && $responsive): ?>
 <div class="table-responsive">
 <?php endif; ?>
 <table <?php if ($classes): print 'class="' . $classes . '" '; endif; ?><?php print $attributes; ?>>
@@ -50,6 +50,6 @@
     <?php endforeach; ?>
   </tbody>
 </table>
-<?php if ($responsive): ?>
+<?php if (isset($responsive) && $responsive): ?>
   </div>
 <?php endif; ?>
