Use mktemp instead of tempfile.