Fix a use-after-free bug in get_recent_address() and two related issues.