Support for sqlite2 and fix broken tests