Fix connected_nodes's bug