Fix a couple of bugs in dir creation