diff --git a/src/gui/mcqr_run_view/mcqrqprocess.cpp b/src/gui/mcqr_run_view/mcqrqprocess.cpp
index 75646941d2911f761958d29da236c19daa46e923..b16271a388e66529c67c7ad1d491a56a87f3064f 100644
--- a/src/gui/mcqr_run_view/mcqrqprocess.cpp
+++ b/src/gui/mcqr_run_view/mcqrqprocess.cpp
@@ -40,14 +40,14 @@ McqrQProcess::~McqrQProcess()
 }
 
 qint64
-McqrQProcess::write(const QByteArray &byte_array)
+McqrQProcess::write(const QString &mcqr_code)
 {
-  m_RscriptRun.append(byte_array);
-  return QProcess::write(byte_array);
+  m_RscriptRun << mcqr_code;
+  return QProcess::write(mcqr_code.toUtf8());
 }
 
-QString
-McqrQProcess::getRScriptRun()
+const QTextStream &
+McqrQProcess::getRScriptRun() const
 {
   return m_RscriptRun;
 }
diff --git a/src/gui/mcqr_run_view/mcqrqprocess.h b/src/gui/mcqr_run_view/mcqrqprocess.h
index 93faa3e5deaca48d73bce01cf8c1cc5c6b6b09fc..9f3220716bce484b0f9aefeb5bad817058581b18 100644
--- a/src/gui/mcqr_run_view/mcqrqprocess.h
+++ b/src/gui/mcqr_run_view/mcqrqprocess.h
@@ -30,6 +30,7 @@
 
 #pragma once
 #include <QProcess>
+#include <QTextStream>
 
 class McqrQProcess : public QProcess
 {
@@ -39,11 +40,11 @@ class McqrQProcess : public QProcess
   ~McqrQProcess();
 
 
-  qint64 write(const QByteArray &byte_array);
+  qint64 write(const QString &mcqr_code);
   void executeOffTheRecord(const QString &mcqr_otr);
   void executeMcqrStep(const QString &mcqr_step_name, const QString &mcqr_step);
-  QString getRScriptRun();
+  const QTextStream &getRScriptRun() const;
 
   private:
-  QString m_RscriptRun;
+  QTextStream m_RscriptRun;
 };
diff --git a/src/gui/mcqr_run_view/mcqrrunview.cpp b/src/gui/mcqr_run_view/mcqrrunview.cpp
index 047e5ae00c4f1008829b2050e4c18f0ab4ad1d4d..823f099fc9b1759a7694fb83d69e0344ea530e2d 100644
--- a/src/gui/mcqr_run_view/mcqrrunview.cpp
+++ b/src/gui/mcqr_run_view/mcqrrunview.cpp
@@ -316,7 +316,7 @@ McqrRunView::saveRunRscript()
   if(qFile.open(QIODevice::WriteOnly))
     {
       QTextStream out(&qFile);
-      out << mp_rProcess->getRScriptRun();
+      out << *(mp_rProcess->getRScriptRun().string());
       qFile.close();
     }
 }