diff --git a/src/core/tandem_run/tandembatchprocess.cpp b/src/core/tandem_run/tandembatchprocess.cpp
index 7497799a1a339ef99c6f14dc0977864904860bef..74abc820c1d3148c063938b3db8f95d4097898db 100644
--- a/src/core/tandem_run/tandembatchprocess.cpp
+++ b/src/core/tandem_run/tandembatchprocess.cpp
@@ -263,7 +263,14 @@ TandemBatchProcess::writeXmlInputFile(QXmlStreamWriter *p_out,
   p_out->writeStartElement("note");
   p_out->writeAttribute("type", "input");
   p_out->writeAttribute("label", "spectrum, path");
-  p_out->writeCharacters(mz_file);
+  if(mz_file_info.isDir())
+    {
+      p_out->writeCharacters(mz_file + "/analysis.tdf");
+    }
+  else
+    {
+      p_out->writeCharacters(mz_file);
+    }
   p_out->writeEndElement();
 
   //<note type="heading">Protein general</note>
@@ -292,8 +299,18 @@ TandemBatchProcess::writeXmlInputFile(QXmlStreamWriter *p_out,
   p_out->writeAttribute("label", "output, path");
   if(mz_file_info.completeSuffix() == "tdf")
     {
+
       QString output_name =
         QFileInfo(mz_file_info.absoluteDir().dirName()).baseName();
+      qDebug() << output_name;
+      p_out->writeCharacters(QString("%1/%2.xml")
+                               .arg(_tandem_run_batch._output_directory)
+                               .arg(output_name));
+    }
+  else if(mz_file_info.isDir())
+    {
+      QString output_name = QFileInfo(mz_file_info).baseName();
+      qDebug() << output_name;
       p_out->writeCharacters(QString("%1/%2.xml")
                                .arg(_tandem_run_batch._output_directory)
                                .arg(output_name));
@@ -316,8 +333,6 @@ TandemBatchProcess::writeXmlInputFile(QXmlStreamWriter *p_out,
 void
 TandemBatchProcess::runOne(const QString &mz_file)
 {
-
-
   QTemporaryFile xml_input_file;
   xml_input_file.setAutoRemove(true);
   if(xml_input_file.open())
diff --git a/src/gui/tandem_run_dialog/tandemrundialog.cpp b/src/gui/tandem_run_dialog/tandemrundialog.cpp
index c4c2e32f0e2213d0e27fdff3722786b72316ba12..ee4d5c24f3c452f8ca18d581360a73fa03f12317 100644
--- a/src/gui/tandem_run_dialog/tandemrundialog.cpp
+++ b/src/gui/tandem_run_dialog/tandemrundialog.cpp
@@ -405,9 +405,10 @@ TandemRunDialog::selectTdfFolder()
     {
       QSettings settings;
       QString default_tdf_location =
-        settings.value("path/tandemrun_tdf_directory", "").toString();
+        settings.value("path/tandemrun_tdf_directory", "/").toString();
       QFileDialog directories_dialog;
-      directories_dialog.setOption(QFileDialog::ShowDirsOnly, true);
+      directories_dialog.setDirectory(default_tdf_location);
+      directories_dialog.setFileMode(QFileDialog::DirectoryOnly);
       directories_dialog.setOption(QFileDialog::DontUseNativeDialog, true);
       directories_dialog.setWindowTitle("Select the timsTOF folders");
       QListView *lView = directories_dialog.findChild<QListView *>("listView");
@@ -424,13 +425,15 @@ TandemRunDialog::selectTdfFolder()
           directories_names = directories_dialog.selectedFiles();
         }
 
-      if(directories_names.size() > 0)
+      if(directories_names.size() > 1)
         {
           settings.setValue("path/tandemrun_tdf_directory",
                             QFileInfo(directories_names[0]).absolutePath());
+          directories_names.pop_front();
         }
       for(QString directory_name : directories_names)
         {
+          // qDebug() << directory_name+"/analysis.tdf";
           if(!QFileInfo(directory_name + "/analysis.tdf").exists())
             {
               throw pappso::PappsoException(
@@ -444,7 +447,6 @@ TandemRunDialog::selectTdfFolder()
       QStringList file_list = _p_mz_file_list->stringList();
       file_list.append(directories_names);
       _p_mz_file_list->setStringList(file_list);
-      
     }
   catch(pappso::PappsoException &error)
     {