added unexpected server disconnection handling