Fixed removing wires sometimes not correctly removing links between gates