here is the current version of this file. I am getting an error saying that I am missing a ")" on line 24(The IofSubStr line). But I just cant see it. Can someone see anything I don't in here?

 Code:
call @Scriptdir + "\ADUtils.udf"
call @Scriptdir + "String.udf"
$output = RedirectOutput("C:\LDAPOutput.txt")
Dim $aAttributes,$sADsPath,$strFilter
Dim $aUsers,$sUser
$RootPath = "E:\HomeFolderTest"

 $aAttributes = "samAccountName", "AdsPath" 
 $sADsPath = "LDAP://"+GetObject("LDAP://rootDSE").Get("defaultNamingContext")  
 $strFilter = "(&(objectClass=User)(objectClass=person)(Name=*))"  
  
 $aUsers = fnLDAPQuery($aAttributes,$sADsPath,$strFilter,"Name")  
 ;? @ERROR " | " @SERROR " when running User Query"

; Ensuring Directories exist
 For $c = 0 to Ubound($aUsers)
    $sDestDir = $RootPath + $aUsers[$c,1]
    $ar_DN = Split($sDestDir,",")
    For each $element in $ar_DN
        $dir = $dir + "\" + Split($Element,"=")[1]
        $sDestDir = $RootPath + $Dir
        If Not (Left($Dir,4)= "\PFS") 
         $sRmv = "\OU3\OU2\OU3"
         $Location = IofSubStr($sDestDir,$sRmv,1)
         $sDestDir = SubStr($sDestDir, 0,$Location) + SubStr($sDestDir, $Location + Len(sRmv), Len $sDestDir)
         ? "Create " + $sDestDir        
;          fnCreateHomeFolder($sDestDir)
        Else
          ? "Skipping Check for " + $Dir
        EndIf
;      EndIf
      Next
 Next
sleep 30
$output = RedirectOutput("")

Function fnCreateHomeFolder($Dir)
  if exist("$Dir")=0
    md "$Dir"
  	if @error=0
	  ? "Home Folder created at $Dir"
	else
	  ? "Home Folder was NOT created at $Dir"
	endif
  endif
EndFunction