added tests for config and fixed some bugs