             if sftpSession != nil {
                 var filesToBeKept = Set<String>()
 
-                for asset in assets {
+                for asset in photoAssets {
                     counter += 1
 
                     // swiftlint:disable:next force_cast

    @IBAction func backupPhotos(sender: UIButton) {
        dismissKeyboard()

        let assets = PHAsset.fetchAssetsWithMediaType(PHAssetMediaType.Image, options: nil)

        dispatch_async(dispatch_get_global_queue(Int(QOS_CLASS_USER_INITIATED.rawValue), 0)) {
            self.lockScreen()

        }
    }

    func getUniqueFilename(date: NSDate, fileData: NSData) -> String {
        let dateFormatter = NSDateFormatter()
        let enUSPosixLocale = NSLocale(localeIdentifier: "en_US_POSIX")
        dateFormatter.locale = enUSPosixLocale
        dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZZ"
        let formattedDate = dateFormatter.stringFromDate(date)

        let hash = fileData.crc32()

        return formattedDate + "_" + hash!.toHexString()
    }
