fix type errors in bytearray conversion functions