bug fix in search, removed some unused stuff