Fix hex conversion bug