fixing the multiple output file naming bug