handle configs in nonstandard places and fix secondary sorting in get_best_secondary