--- includes/common.inc.orig	2008-08-15 23:26:48.000000000 +0200
+++ includes/common.inc	2008-08-15 23:32:16.000000000 +0200
@@ -2765,6 +2765,11 @@
     // Render all the children that use a theme function.
     if (isset($elements['#theme']) && empty($elements['#theme_used'])) {
       $elements['#theme_used'] = TRUE;
+
+      $previous = array();
+      foreach (array('#type', '#prefix', '#suffix') as $key) {
+        $previous[$key] = isset($elements[$key]) ? $elements[$key] : NULL;
+      }
       // If we rendered a single element, then we will skip the renderer.
       if (empty($children)) {
         $elements['#printed'] = TRUE;
@@ -2773,7 +2778,12 @@
         $elements['#markup'] = '';
       }
 
+      unset($elements['#prefix'], $elements['#suffix']);
       $content = theme($elements['#theme'], $elements);
+
+      foreach (array('#type', '#prefix', '#suffix') as $key) {
+        $elements[$key] = isset($previous[$key]) ? $previous[$key] : NULL;
+      }
     }
     // Render each of the children using drupal_render and concatenate them.
     if (!isset($content) || $content === '') {
