fixed TypeError: 'str' does not support the buffer interfacein python 3

Fixed an error when using the buffer interface in python3. Hope this works and helps.