Fix handling of multiple pages.