fix bug of num_pages and class method