Fix a bug where directory creation was not respecting DEFAULT_DIRECTORY_PERMS.