fixed bug in pagination