set mask early so getdirectory can use it