Corrected set_neighbor