Bug fix for dir creation