fixing bugs for searching