Search optimization bug fix