Fix bug with connecting node to itself.