Fix major socket leakage