Index: media.php
===================================================================
--- media.php	(revision 15364)
+++ media.php	(working copy)
@@ -837,9 +837,9 @@
 			#{$selector} .gallery-caption {
 				margin-left: 0;
 			}
-		</style>
-		<!-- see gallery_shortcode() in wp-includes/media.php -->
-		<div id='$selector' class='gallery galleryid-{$id}'>");
+		</style>");
+	$output .= "<!-- see gallery_shortcode() in wp-includes/media.php -->
+		<div id='$selector' class='gallery galleryid-{$id}'>";
 
 	$i = 0;
 	foreach ( $attachments as $id => $attachment ) {
