Fix hash_resource to avoid encode errors.