fix self-connecting problem