Fixed to allow termination of sockets