Fix directory test in script