     }
 
     @IBAction func connect(_ sender: NSButton) {
-        guard self.rsyncindex != nil else { return }
+        guard self.rsyncindex != nil && self.rcloneindex != nil else { return }
+        guard  self.configurations!.getConfigurations()[self.rsyncindex!].task != ViewControllerReference.shared.combined else { return}
         if let rclonehiddenID = self.configurationsrclone?.gethiddenID(index: self.rcloneindex!) {
             self.configurations!.setrcloneconnection(index: self.rsyncindex!, rclonehiddenID: rclonehiddenID, rcloneprofile: rcloneprofilename)
-            self.updateview()
-        }
+        }
+         self.updateview()
     }
 
     @IBAction func reset(_ sender: NSButton) {
         guard self.rsyncindex != nil else { return }
         self.configurations!.deletercloneconnection(index: self.rsyncindex!)
         self.updateview()
-        self.connectbutton.isEnabled = self.enableconnectionbutton()
-        self.resetbutton.isEnabled = self.enableresetbutton()
     }
 
     @IBAction func selectprofile(_ sender: NSComboBox) {

            guard rcloneindex >= 0 else { return }
            self.rcloneID.stringValue = self.configurationsrclone!.getConfigurations()[rcloneindex].backupID
            self.rcloneremotecatalog.stringValue = self.configurationsrclone!.getConfigurations()[rcloneindex].offsiteCatalog
        }
    }

    private func enableconnectionbutton() -> Bool {
        guard self.rsyncindex != nil && self.rcloneindex != nil else { return false }
        let rclonehiddenID = self.configurationsrclone!.gethiddenID(index: self.rcloneindex!)
        let rcloneremotecatalog = self.configurationsrclone!.getResourceConfiguration(rclonehiddenID, resource: .remoteCatalog) + "/"
        let rsynclocalcatalog = self.localCatalog.stringValue
        if rcloneremotecatalog == rsynclocalcatalog {
            return true
        } else {
            return false
        }
    }

    private func enableresetbutton() -> Bool {
        guard self.forceresetbutton.state == .off else { return true }
        guard self.rsyncindex != nil && self.rcloneindex != nil else { return false }
        if self.configurationsrclone!.getConfigurations()[self.rcloneindex!].hiddenID == self.configurations?.getConfigurations() [self.rsyncindex!].rclonehiddenID
            && self.rcloneprofilename == self.configurations?.getConfigurations() [self.rsyncindex!].rcloneprofile {
            return true
        } else {
            return false
        }
    }


                self.rsyncindex = nil
            }
        }
        self.connectbutton.isEnabled = !self.isconnected(row: self.rcloneindex)
        self.resetbutton.isEnabled = self.isconnected(row: self.rcloneindex)
    }
}

