Fixed permissions on template directories.
Address style concerns in setting mkdir/copy flags.
Merge pull request #2359 from e45lee/chmod-fix

Fixed permissions on template directories.