Fix the session login/logout flow.