     */
     public static func saveUIImage(image: UIImage) -> String? {
         
-        let docsPath = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true)[0] as String
+        let docsPath = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true)[0] as! String
         let imageDirPath = docsPath.stringByAppendingPathComponent("SwiftDataImages")
 
         if !NSFileManager.defaultManager().fileExistsAtPath(imageDirPath) {

        //create the database path
        class func createPath() -> String {
            
            let docsPath = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true)[0] as String
            let databaseStr = "SwiftData.sqlite"
            let dbPath = docsPath.stringByAppendingPathComponent(databaseStr)
            

            if obj is NSDate {
                let dateFormatter = NSDateFormatter()
                dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
                return "\(escapeValue(dateFormatter.stringFromDate(obj as! NSDate)))"
            }
            
            if obj is UIImage {
                if let imageID = SD.saveUIImage(obj as! UIImage) {
                    return "'\(escapeStringValue(imageID))'"
                }
                println("SwiftData Warning -> Cannot save image, NULL will be inserted into the database")
