Fix pagination.
Closes issue #269