bug fix when total pages == 1