fix search and pagination issue