fixing mkdir logic