fix a bug of synchronization in search_dir