Fix error when allocating from mkpath