fixes and refactor in config reader