fixing a bug in search