Fix for directory creating bug