fix script when directory are not present