fix directory creation bug