Fixed issue with detection of existing session.