improved cfg file selection