Fix portability issue with struct.unpack()

It was provided a bytearray while expecting a string.