fixed some bugs in search