fixed the js so search behaves as expected