Check for TMPDIR on systems where missing environmental varialbles cause errors. Thanks to Tim Fennell