solve some bug in add_neighbor and set_seed