fix bug in config files and clean up code a bit