change mkdir to makedirs.

Use makedirs to create directory recursively.