Replace old reference resolution with more robust method