Bug fix in test exception handling code.
Bug fix in scripts/functional_tests.py.
A tempdir is referenced before it is created in certain cases.