Fixed the mkdir calls to actually create the files with the right perms.