fix gotopage function