Corrected bug in output file name parsing