Use mktemp instead of tempfile

The latter is not always available (thx joker)