Fix mkdir bug + unit test.