update session and fix logout bug