Fixed few bugs in the search API