diff --git a/wp-blog-header.php b/wp-blog-header.php
index 562514d2b9..f426c37a64 100644
--- a/wp-blog-header.php
+++ b/wp-blog-header.php
@@ -145,10 +145,6 @@ if ( is_404() ) {
 	}
 }
 
-// Getting settings from DB
-if ( isset($doing_rss) && $doing_rss == 1 )
-    $posts_per_page = get_settings('posts_per_rss');
-
 $use_gzipcompression = get_settings('gzipcompression');
 
 $more_wpvars = array('posts_per_page', 'posts_per_archive_page', 'what_to_show', 'showposts', 'nopaging');
diff --git a/wp-includes/classes.php b/wp-includes/classes.php
index ab22adcc6d..d1ca7dd9ec 100644
--- a/wp-includes/classes.php
+++ b/wp-includes/classes.php
@@ -244,6 +244,8 @@ class WP_Query {
 				$q['nopaging'] = false;
 			}
 		}
+		if ( $this->is_feed )
+			$q['posts_per_page'] = get_settings('posts_per_rss');
 	
 		$add_hours = intval(get_settings('gmt_offset'));
 		$add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours));