Fix error: "TypeError: 'str' does not support the buffer interface"