Fix an issue where the dbname specified on the command line was being ignored