                     return
                 }
                 
+                guard response?.mimeType == expectedContentType else {
+                    print("Ignoring response for radical \(id) with style name \(styleName): incorrect content type (expected '\(expectedContentType)', got '\(response?.mimeType ?? "")')")
+                    return
+                }
+                
                 try? fileManager.removeItem(at: destination)
                 
                 do {

        fileManager.createFile(atPath: destinationBaseURL.appendingPathComponent("Contents.json").path, contents: imagesetContents, attributes: nil)
    }
}
print("Done")

            task.resume()
        }
        downloadGroup.wait()
        
        guard try fileManager.contentsOfDirectory(atPath: destinationBaseURL.path).count > 0 else {
            print("Removing empty directory for radical \(id)")
            try fileManager.removeItem(at: destinationBaseURL)
            continue
        }
        
        let imagesetContents = """
            {
