Writing string instead of bytes to fix py3 compat