Fixed a bug where the page number was not being reset to 1.

Added logging of erroneous records