Correctly return number of pages.