fixes to allow multiple database connection.