fix output file name choosing