Fix config writing for python 3