fix ptoh and add test for hexa