 
         self.targetDevice.transceiver!.sendCreateNetwork(name: self.newNetworkName!, password: self.newNetworkPassword!) { result, networkInfo in
             self.log("targetDevice.sendCreateNetwork: \(result.description()), networkInfo: \(networkInfo as Optional)")
+            if (self.canceled) {
+                return
+            }
             if (result == .NONE) {
                 self.log("Setting current target device as commissioner device")
                 self.commissionerDevice = self.targetDevice

        self.currentStepFlags["firmwareData"] = firmwareData
        self.targetDevice.transceiver!.sendStartFirmwareUpdate(binarySize: firmwareData.count) { result, chunkSize in
            self.log("targetDevice.sendStartFirmwareUpdate: \(result.description()), chunkSize: \(chunkSize)")
            if (result == .NONE) {
                self.currentStepFlags["chunkSize"] = Int(chunkSize)
                self.currentStepFlags["idx"] = 0

    private func stepEnsureTargetDeviceIsNotOnMeshNetwork() {
        self.targetDevice.transceiver!.sendGetNetworkInfo { result, networkInfo in
            self.log("targetDevice.sendGetNetworkInfo: \(result.description())")
            if (self.canceled) {
                return
            }
            if (result == .NOT_FOUND) {
                self.targetDevice.networkInfo = nil
                self.targetDeviceLeaveNetwork()
