fix output file name with multiple "." in file name