fix a bug in the output filename formation.