Fixed bug in creating directories