fixed a few bugs related to search

try catch
try catch everywhere