Improve search of the session id - refs BT#8193