add refresh function and fix numbers of pages