Fix logic for email and pop-up notices of expiring agreements.