Fixed a bug in removeSpanPorts