fix a bug where expiry time was not being used