Some changes for python 2

byte array handling is very different between python 2 and 3. To get
this working under python 3 undo these changes.