config: Handle encoding and other minor refactoring mistakes