Fix issue with expire and improve type spec