Fix detection of end of first page.