fixed error when client disconnects