Added check for existing session in constructor