update of changePage function