Fix bugs in mkdir