-check for inconsistent state in a few places to guard against nil errors
-make sure the page number is a number in the page callback
------------------------------------------------------------------------