fixed bug with pagination