Change makedirs to be conditional