fix bug with search logic+pagination