Sqlite

Make things much easier for SQLite, as well as a few other fixes.