Work-around the possibility of the temporary file write at start, taking a long time.
Changed some trace code to only output in debug builds.