Fix issue with socket reuse