Fix bug introduced by enhanced session management (PR #2098)