Use generic_string() in a couple of places to avoid unwanted backslashes in filenames.