improved cache dir creation