added a else to the goToPage method and commented out the first part of the goToPreviousPage method
now if you are in the middle of a node goToPage works