Fixed creation of output directories