Index: wp-includes/theme.php
===================================================================
--- wp-includes/theme.php	(revision 6574)
+++ wp-includes/theme.php	(working copy)
@@ -98,9 +98,9 @@
 	$name = $theme = wp_kses( trim( $theme_name[1] ), $themes_allowed_tags );
 	$theme_uri = clean_url( trim( $theme_uri[1] ) );
 	$description = wptexturize( wp_kses( trim( $description[1] ), $themes_allowed_tags ) );
-	$template = wp_kses( trim( $template[1] ), $themes_allowed_tags );
+	$template = wp_kses( trim( (isset($template[1])) ? $template[1] : '' ), $themes_allowed_tags );
 
-	$author_uri = clean_url( trim( $author_uri[1] ) );
+	$author_uri = clean_url( trim( (isset($author_uri[1])) ? $author_uri[1] : '' ) );
 
 	if ( empty( $author_uri[1] ) ) {
 		$author = wp_kses( trim( $author_name[1] ), $themes_allowed_tags );
Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 6574)
+++ wp-includes/functions.php	(working copy)
@@ -990,9 +990,10 @@
 
 
 function wp_get_referer() {
-	foreach ( array( $_REQUEST['_wp_http_referer'], $_SERVER['HTTP_REFERER'] ) as $ref )
-		if ( !empty( $ref ) )
-			return $ref;
+	if ( ! empty( $_REQUEST['_wp_http_referer'] ) )
+		return $_REQUEST['_wp_http_referer'];
+	else if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) 
+		return $_SERVER['HTTP_REFERER'];
 	return false;
 }
 
