Fix config.reset and refactor