added auto session handling