Fix script when directories aren't created