updated network reconnect code