Add some boolean type checking to hash_to_object.