fixes to the pagechangeing function