fix to create intermediate dirs if not available as well