num_to_hex and test fix