fixed get_last_page_num bug