                 entity.setValue(uuid, forKey: "uuid")
                 entity.setValue(url.path, forKey: "url")
             } else {
-                entity = results[0] as! NSManagedObject
+                entity = results[0]
                 uuid = entity.value(forKey: "uuid") as! String
                 //MyLog("SNAsset found entity=\(uuid)")
             }

            MyLog("SWAsset flush contentsOfDir failed (somethign is wrong)")
        }

        let request = NSFetchRequest(entityName: "Asset")
        do {
            if let entities = try managedObjectContext.fetch(request) as? [NSManagedObject] {
                MyLog("SNAsset flush count=\(entities.count)", level:1)
                for entity in entities {
                    managedObjectContext.delete(entity)
                }
                saveContext()
            }
        } catch {
            MyLog("SWAsset flush fetch failed (something is wrong)")
        }

        //MyLog("SNAsset loadAsset url = \(url)")
        //MyLog("SNAsset context = \(managedObjectContext)")
        
        let request = NSFetchRequest<NSManagedObject>(entityName: "Asset")
        request.predicate = Predicate(format: "url == %@", url.path!)
        do {
            let results = try managedObjectContext.fetch(request)
