fix expiry logic