borrow code to try to fix deprecated hpg_resolve