I don't have time right now to fix it, but it looks like any call to ad_conn url will break.
Pinning down where to set ad_conn url is tricky, so if you get a chance, any help would be appreciated.