 
         let diff = Date().timeIntervalSince(self.currentStepFlags["checkTargetDeviceGotConnectedStartTime"] as! Date)
         if (diff > MeshSetup.deviceConnectToCloudTimeout) {
-            self.currentStepFlags["checkTargetDeviceGotConnectedStartTime"] = nil
             self.fail(withReason: .DeviceConnectToCloudTimeout)
             return
         }

            return
        }

        self.log("password set: \(password)")
        self.selectedNetworkPassword = password

        /// NOT_FOUND: The device is not a member of a network
        /// NOT_ALLOWED: Invalid commissioning credential
        self.commissionerDevice!.transceiver!.sendAuth(password: password) { result in
            if (self.canceled) {
                return
            }
            self.log("commissionerDevice.sendAuth: \(result.description())")
            if (result == .NONE) {
                onComplete(nil)
                self.stepComplete()
            } else if (result == .NOT_ALLOWED) {
                onComplete(.WrongNetworkPassword)
            } else {
                self.handleBluetoothErrorResult(result)
            }
        }
    }


    //MARK: JoinNetwork
    private func stepJoinSelectedNetwork() {
        self.delegate.meshSetupDidEnterState(state: .JoiningNetworkStarted)
        /// NOT_ALLOWED: The client is not authenticated


        let diff = Date().timeIntervalSince(self.currentStepFlags["checkTargetDeviceGotClaimedStartTime"] as! Date)
        if (diff > MeshSetup.deviceGettingClaimedTimeout) {
            fail(withReason: .DeviceGettingClaimedTimeout)
            return
        }
