Fix encoding of binary data type