Add finalize and trace hooks for proxies.