Make the base directory before write check
Fix indent