fixed bug in output file name