Fix some test issues and allow persistent database connections