Fixed bug with total pages