fixed typo in advancedconnect

function advancedconnect() failed due to typo in global variable env (was evn).