improve expired check