fix bug in search.c