diff --git a/lib/exe/css.php b/lib/exe/css.php
index fb639fc7e3e2516786096a7321e2b935b56825bd..8899ff1936e0bfcee5fd1383b79c2afa454dacae 100644
--- a/lib/exe/css.php
+++ b/lib/exe/css.php
@@ -66,9 +66,6 @@ function css_out(){
         $config_cascade['userstyle']['screen'] = $config_cascade['userstyle']['default'];
     }
 
-    // start output buffering
-    ob_start();
-
     // Array of needed files and their web locations, the latter ones
     // are needed to fix relative paths in the stylesheets
     $files = array();
@@ -114,6 +111,9 @@ function css_out(){
     http_cached($cache->cache,
                 $cache->useCache(array('files' => $cache_files)));
 
+    // start output buffering
+    ob_start();
+
     // build the stylesheet
     foreach ($mediatypes as $mediatype) {