fix expiration to exit correctly