Fixed object writing with type as uint8_t, added bytearray writing