numerous minor fixes, SQLite3 fixes