prevent session start when it is not needed.
(cherry picked from commit a254c5db800624018fab9fc1438f4ab2e599ba56)