correct some bugs
change the config system to be more flexible