Improve the tempname position-keeping behaviour significantly, hammering out a potential crash bug too.