Improved tests to use temporary files.