Properly set expiration #2031
Fix fatal error in unit tests. #2302