Bug fix for number of pages