Correctly determine output location of files.