Index: wp-includes/query.php
===================================================================
--- wp-includes/query.php	(revision 23996)
+++ wp-includes/query.php	(working copy)
@@ -1699,7 +1699,7 @@
 			);
 		}
 
-		foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) {
+		foreach ( get_taxonomies( array() , 'objects' ) as $taxonomy => $t ) {
 			if ( 'post_tag' == $taxonomy )
 				continue;	// Handled further down in the $q['tag'] block
 
Index: wp-includes/rewrite.php
===================================================================
--- wp-includes/rewrite.php	(revision 23996)
+++ wp-includes/rewrite.php	(working copy)
@@ -331,7 +331,14 @@
 	$url = trim($url, '/');
 
 	$request = $url;
-
+        $post_type_query_vars = array();
+        
+        foreach ( get_post_types( array() , 'objects' ) as $post_type => $t ) {
+            if ( !empty( $t->query_var ) ) {
+                $post_type_query_vars[ $t->query_var ] = $post_type;
+            }
+        }
+        
 	// Look for matches.
 	$request_match = $request;
 	foreach ( (array)$rewrite as $match => $query) {
@@ -361,8 +368,13 @@
 			parse_str($query, $query_vars);
 			$query = array();
 			foreach ( (array) $query_vars as $key => $value ) {
-				if ( in_array($key, $wp->public_query_vars) )
+				if ( in_array($key, $wp->public_query_vars) ){
 					$query[$key] = $value;
+                                        if ( isset( $post_type_query_vars[$key] ) ) {
+                                                $query['post_type'] = $post_type_query_vars[$key];
+                                                $query['name']      = $value;
+                                        }    
+                                }
 			}
 
 			// Do the query
Index: wp-includes/class-wp.php
===================================================================
--- wp-includes/class-wp.php	(revision 23996)
+++ wp-includes/class-wp.php	(working copy)
@@ -247,7 +247,7 @@
 
 		$this->public_query_vars = apply_filters('query_vars', $this->public_query_vars);
 
-		foreach ( $GLOBALS['wp_post_types'] as $post_type => $t )
+		foreach ( get_post_types(array(),'objects') as $post_type => $t )
 			if ( $t->query_var )
 				$post_type_query_vars[$t->query_var] = $post_type;
 
@@ -280,7 +280,7 @@
 		}
 
 		// Convert urldecoded spaces back into +
-		foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t )
+		foreach ( get_taxonomies( array() , 'objects' ) as $taxonomy => $t )
 			if ( $t->query_var && isset( $this->query_vars[$t->query_var] ) )
 				$this->query_vars[$t->query_var] = str_replace( ' ', '+', $this->query_vars[$t->query_var] );
 
