create_dirs slightly more robust