Fixing up some issues caused by the migration to Sqlite3