Fix go to previous page function