Fix bug in database connection.