Debug MergeTop and add security to trailing slash in outputDirectory