bug fix on pagination