fix defer and session id