Fixed bugs in search