fixed a bug with disconnecting wires