Fixed bug where directories were being created in the incorrect location