Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 21573)
+++ wp-includes/functions.php	(working copy)
@@ -1432,7 +1432,6 @@
  * @return array See above for description.
  */
 function wp_upload_dir( $time = null ) {
-	global $_wp_switched;
 	$siteurl = get_option( 'siteurl' );
 	$upload_path = get_option( 'upload_path' );
 	$upload_path = trim($upload_path);
@@ -1456,12 +1455,12 @@
 			$url = trailingslashit( $siteurl ) . $upload_path;
 	}
 
-	if ( defined('UPLOADS') && ! $main_override && ! $_wp_switched ) {
+	if ( defined('UPLOADS') && ! $main_override && ! ms_is_switched() ) {
 		$dir = ABSPATH . UPLOADS;
 		$url = trailingslashit( $siteurl ) . UPLOADS;
 	}
 
-	if ( is_multisite() && ! $main_override && ! $_wp_switched  ) {
+	if ( is_multisite() && ! $main_override && ! ms_is_switched()  ) {
 		if ( defined( 'BLOGUPLOADDIR' ) )
 			$dir = untrailingslashit(BLOGUPLOADDIR);
 		$url = str_replace( UPLOADS, 'files', $url );
Index: wp-includes/ms-blogs.php
===================================================================
--- wp-includes/ms-blogs.php	(revision 21573)
+++ wp-includes/ms-blogs.php	(working copy)
@@ -462,7 +462,6 @@
 	* the extra unnecessary work */
 	if ( $new_blog == $GLOBALS['blog_id'] ) {
 		do_action( 'switch_blog', $new_blog, $new_blog );
-		$GLOBALS['_wp_switched'] = true;
 		return true;
 	}
 
@@ -499,7 +498,6 @@
 	}
 
 	do_action( 'switch_blog', $new_blog, $prev_blog_id );
-	$GLOBALS['_wp_switched'] = true;
 
 	return true;
 }
@@ -515,15 +513,13 @@
 function restore_current_blog() {
 	global $wpdb, $wp_roles;
 
-	if ( ! $GLOBALS['_wp_switched'] )
+	if ( empty( $GLOBALS['_wp_switched_stack'] ) )
 		return false;
 
 	$blog = array_pop( $GLOBALS['_wp_switched_stack'] );
 
 	if ( $GLOBALS['blog_id'] == $blog ) {
 		do_action( 'switch_blog', $blog, $blog );
-		// If we still have items in the switched stack, consider ourselves still 'switched'
-		$GLOBALS['_wp_switched'] = ! empty( $GLOBALS['_wp_switched_stack'] );
 		return true;
 	}
 
@@ -560,10 +556,6 @@
 	}
 
 	do_action( 'switch_blog', $blog, $prev_blog_id );
-
-	// If we still have items in the switched stack, consider ourselves still 'switched'
-	$GLOBALS['_wp_switched'] = ! empty( $GLOBALS['_wp_switched_stack'] );
-
 	return true;
 }
 
@@ -575,7 +567,7 @@
  * @return bool True if switched, false otherwise.
  */
 function ms_is_switched() {
-	return $GLOBALS['_wp_switched'];
+	return ! empty( $GLOBALS['_wp_switched_stack'] );
 }
 
 /**
Index: wp-includes/ms-settings.php
===================================================================
--- wp-includes/ms-settings.php	(revision 21573)
+++ wp-includes/ms-settings.php	(working copy)
@@ -127,7 +127,6 @@
 $wpdb->set_blog_id( $current_blog->blog_id, $current_blog->site_id );
 $table_prefix = $wpdb->get_blog_prefix();
 $_wp_switched_stack = array();
-$_wp_switched = false;
 
 // need to init cache again after blog_id is set
 wp_start_object_cache();
