Fixed a bug that causes mistake when two nodes, still not correct when
three nodes.