fixing paginate bugs