Fixed crashes of the socket connection interface.