fixed a bug in the output file name generation