fixed bug if there is only one page