instead of this crazy conditional check, the config directory should be a parameter that is passed from the outside.