--- shell/ev-jobs.c-old	2008-03-17 20:11:57.000000000 +0100
+++ shell/ev-jobs.c	2008-03-17 20:08:12.000000000 +0100
@@ -922,33 +922,30 @@
 		gint n_copies;
 		
 		step = job->reverse ? -1 * job->pages_per_sheet : job->pages_per_sheet;
-		page = job->reverse ? (n_pages / job->pages_per_sheet) * job->pages_per_sheet  : 0;
-		n_copies = job->collate ? job->copies : 1;
+		page = job->reverse ? ((n_pages - 1) / job->pages_per_sheet) * job->pages_per_sheet : 0;
+		n_copies = job->collate ? 1 : job->copies;
 
 		while ((job->reverse && (page >= 0)) || (!job->reverse && (page < n_pages))) {
 			gint k;
 
-			ev_file_exporter_begin_page (EV_FILE_EXPORTER (document));
-			
-			for (j = 0; j < job->pages_per_sheet; j++) {
-				gint p = page + j;
-				
-				if (p < 0 || p >= n_pages)
-					break;
-
-				ev_render_context_set_page (rc, page_list[p]);
-
-				for (k = 0; k < n_copies; k++) {
+			for (k = 0; k < n_copies; k++) {
+				ev_file_exporter_begin_page (EV_FILE_EXPORTER (document));
+				for (j = 0; j < job->pages_per_sheet; j++) {
+					gint p = page + j;
+
+					if (p < 0 || p >= n_pages)
+						break;
+					ev_render_context_set_page (rc, page_list[p]);
 					ev_file_exporter_do_page (EV_FILE_EXPORTER (document), rc);
 				}
-			}
 
-			ev_file_exporter_end_page (EV_FILE_EXPORTER (document));
+				ev_file_exporter_end_page (EV_FILE_EXPORTER (document));
+			}
 
 			page += step;
 		}
 
-		if (job->collate)
+		if (!job->collate)
 			break;
 	}
 
