fixed bug on pagination