Replaces temfile by mktemp.