SQLite fixes, conf fixes, attempt to fix memleaks