add unittests for confighelp
fix bugs uncovered by unittests