Fix conversion of binary data to hexadecimal strings in some cases.