                     DKImageAssetExporter.ioQueue.async {
                         if var imageData = data {
                             if let info = info, let fileURL = info["PHImageFileURLKey"] as? NSURL {
-                                asset.fileName = fileURL.lastPathComponent
+                                asset.fileName = fileURL.lastPathComponent ?? asset.localIdentifier
                             } else {
                                 asset.fileName = asset.localIdentifier
                             }
+                            
+                            asset.localTemporaryPath = asset.localTemporaryPath?.appendingPathComponent(asset.fileName!)
                             
                             if FileManager.default.fileExists(atPath: asset.localTemporaryPath!.path) {
                                 return completion(nil)

                asset.localTemporaryPath = self.generateTemporaryPath(with: asset)
                asset.error = nil
                
                if let localTemporaryPath = asset.localTemporaryPath, FileManager.default.fileExists(atPath: localTemporaryPath.path) {
                    exportCompletionBlock(asset, nil)
                    continue
                }

    }
    
    private func generateTemporaryPath(with asset: DKAsset) -> URL {
        var directoryName: String!
        if let originalAsset = asset.originalAsset {
            let localIdentifier = originalAsset.localIdentifier
            directoryName = localIdentifier.data(using: .utf8)?.base64EncodedString()
            
            if let modificationDate = originalAsset.modificationDate {
                directoryName = directoryName + "/" + String(modificationDate.timeIntervalSinceReferenceDate)
            }
            
            if asset.type == .photo {
                directoryName = directoryName + "/" + String(self.configuration.imageExportPreset.rawValue)
            } else {
                #if swift(>=4.0)
                directoryName = directoryName + "/" + self.configuration.videoExportPreset + self.configuration.avOutputFileType.rawValue
                #else
                directoryName = directoryName + "/" + self.configuration.videoExportPreset + self.configuration.avOutputFileType
                #endif
            }
        } else {
            directoryName = asset.localIdentifier
        }
        
        let directory = self.configuration.exportDirectory.appendingPathComponent(directoryName)
        
        if !FileManager.default.fileExists(atPath: directory.path) {
            try? FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true, attributes: nil)
        }
        
        return directory
    }
    
    static let ioQueue = DispatchQueue(label: "DKPhotoImagePreviewVC.ioQueue")
