Fixed a bug in threadsearch