hex2int: fix hex digit parsing