diff --git a/inc/template.php b/inc/template.php
index 7b0ef466b11a79cb33c5db2e938449ecbff99dd6..3eda2f4af704450c36246ddd6fdda8bcd2198891 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -1407,5 +1407,18 @@ function tpl_subscribe() {
     echo '</div>';
 }
 
+/**
+ * Tries to send already created content right to the browser
+ *
+ * Wraps around ob_flush() and flush()
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ */
+function tpl_flush(){
+    ob_flush();
+    flush();
+}
+
+
 //Setup VIM: ex: et ts=4 enc=utf-8 :
 
diff --git a/lib/tpl/default/main.php b/lib/tpl/default/main.php
index b5717c00972d99022ae1a349f00b14ec441b5831..d9231678b0a7aa9d0618f5437f0aaa9e5c002037 100644
--- a/lib/tpl/default/main.php
+++ b/lib/tpl/default/main.php
@@ -82,7 +82,7 @@ if (!defined('DOKU_INC')) die();
     <?php }?>
 
   </div>
-  <?php flush()?>
+  <?php tpl_flush()?>
 
   <?php /*old includehook*/ @include(dirname(__FILE__).'/pageheader.html')?>
 
@@ -94,7 +94,7 @@ if (!defined('DOKU_INC')) die();
 
   <div class="clearer">&nbsp;</div>
 
-  <?php flush()?>
+  <?php tpl_flush()?>
 
   <div class="stylefoot">