compute expiration properly