hex_to_hash() fixes

Just a few obvious bugs I ran into.