Fixed bug where client disconnection led to segmentation fault