use temp filename, not curdir

Ready for review & merge