Fix loading of outputDir and improve testability