open directory fix, thanks to vt@juick