fix config file and main exit