fix bugs in search