fix logout bug (logout was not terminating previous session)