Added better treatment of server disconnect