renamed `prepare_dirs` -> `safe_makedirs`