fixed problem with socket ownership