 
         log.debug("Creating \(queries.count) tables, views, and indices.")
 
-        return self.run(db, queries: queries.filter({ $0.0 != nil }).map({ ($0.0!, $0.1) })) &&
+        return self.runValidQueries(db, queries: queries) &&
                self.prepopulateRootFolders(db)
     }
 

                ("ALTER TABLE \(TableHistory) ADD COLUMN domain_id INTEGER REFERENCES \(TableDomains)(id) ON DELETE CASCADE", nil)
            ]

            if !self.run(db, queries: queries.filter({ $0.0 != nil }).map({ ($0.0!, $0.1) })) {
                return false
            }


        for (sql, args) in queries {
            if !run(db, sql: sql, args: args) {
                return false
            }
        }
        return true
    }

    func runValidQueries(db: SQLiteDBConnection, queries: [(String?, Args?)]) -> Bool {
        for (sql, args) in queries {
            if let sql = sql {
                if !run(db, sql: sql, args: args) {
                    return false
                }
            }
        }
        return true
