fix a bug in search.c