fix duplex leak memory