Fix a problem of session checking.