fix the check logic of cookie lifetime