diff --git a/modules/gui/src/gosty.cc b/modules/gui/src/gosty.cc
index f7d452b4dc038eb5e77f43bc9aa04487cf400560..6f5ceaa55b0b25dedf58315ad3a5f1c25dd9755d 100644
--- a/modules/gui/src/gosty.cc
+++ b/modules/gui/src/gosty.cc
@@ -145,20 +145,10 @@ int init_python_interpreter()
 
 void prepare_scripts(int argc, char** argv, PythonInterpreter& py)
 {
-  QTextStream stdin_stream(stdin);
-  QString stdin_line;
-  QString script_qstring("");
-  stdin_line=stdin_stream.readLine();
-  while (!stdin_line.isNull())
-  {
-    stdin_line.append("\n");
-    script_qstring += stdin_line;
-    stdin_line=stdin_stream.readLine();
-  }
-  for (int param_iter=1; param_iter<argc; ++param_iter) {
+  for (int param_iter=2; param_iter<argc; ++param_iter) {
     py.AppendCommandlineArgument(QString(argv[param_iter]));
   }
-  py.RunCommand(script_qstring);
+  py.RunScript(argv[1]);
 }
 
 
diff --git a/modules/gui/src/python_shell/python_interpreter.cc b/modules/gui/src/python_shell/python_interpreter.cc
index 4af471f17a8b2017fd32898fa0e99ed1808c1697..2ac697de50880e3081905be5b4eae14bd0d65520 100644
--- a/modules/gui/src/python_shell/python_interpreter.cc
+++ b/modules/gui/src/python_shell/python_interpreter.cc
@@ -31,6 +31,7 @@
 
 #include <boost/filesystem/convenience.hpp>
 
+#include <QFile>
 #include <QDebug>
 #include <QApplication>
 #include <QThread>
@@ -196,25 +197,13 @@ void PythonInterpreter::ExecRelease()
 
 void PythonInterpreter::RunScript(const String& fname)
 {
-  std::ifstream script(fname.c_str());
-  if(!script) {
+    QFile file(QString::fromStdString(fname));
+  if (!file.open(QIODevice::ReadOnly | QIODevice::Text)){
     LOGN_ERROR("could not open " << fname);
     return;
   }
-
-  String line;
-  QString command("");
-  while(std::getline(script,line)) {
-    command.append(QString::fromStdString(line));
-    command.append('\n');
-    if(this->GetCodeBlockStatus(command)!=CODE_BLOCK_INCOMPLETE) {
-      if(!RunCommand(command)) break;
-      command=QString("");
-    }
-  }
-  command.append('\n');
-  command.append('\n');
-  RunCommand(command);
+  QTextStream in(&file);
+  RunCommand(in.readAll());
 }
 
 bool PythonInterpreter::IsSimpleExpression(const QString& expr)
diff --git a/scripts/dng.bat.in b/scripts/dng.bat.in
index b54761f5cde8a36979bc8dee20e95f42eb55d60c..0de8f7fe3a0c4875d1076438936f45a19ee027f5 100644
--- a/scripts/dng.bat.in
+++ b/scripts/dng.bat.in
@@ -27,5 +27,5 @@ echo Starting DNG in %BIN_DIR%
 
 set DNG_ROOT=%BIN_DIR%\..
 set PATH=%BIN_DIR%;%DNG_ROOT%\@LIBDIR@\Release;%DNG_ROOT%\@LIBDIR@;%DNG_ROOT%\bin\Release;%PATH%
-REM type %DNG_ROOT%\@LIBDIR@\openstructure\init.py | %BIN_DIR%@BUILD_TYPE@\gosty.exe ost %*
-type "%DNG_ROOT%\@LIBDIR@\openstructure\init.py" | "%BIN_DIR%Release\gosty.exe" ost %*
+REM "%BIN_DIR%Release\gosty.exe" %DNG_ROOT%\@LIBDIR@\openstructure\init.py ost %*
+"%BIN_DIR%Release\gosty.exe" "%DNG_ROOT%\@LIBDIR@\openstructure\init.py" ost %*
diff --git a/scripts/dng.in b/scripts/dng.in
index 1a5c4e33e5275408c8f133596507ab2325bf0789..809ee5f9355962655e11c84ff481825963fb24b5 100755
--- a/scripts/dng.in
+++ b/scripts/dng.in
@@ -30,4 +30,4 @@ export LD_LIBRARY_PATH=$DNG_ROOT/@LIBDIR@:$LD_LIBRARY_PATH
 #export PYTHONHOME=$DNG_ROOT
 #export QT_PLUGIN_PATH=$BIN_DIR/plugins
 
-cat "$DNG_ROOT/@LIBDIR@/openstructure/init.py" | gosty ost $@
\ No newline at end of file
+gosty $DNG_ROOT/@LIBDIR@/openstructure/init.py ost $@
diff --git a/scripts/gipltng.bat.in b/scripts/gipltng.bat.in
index d57678355b79dbf1a85701614b3e513cc63245e8..c2dabf0290290e83e308ade392727b53fd4b5de7 100644
--- a/scripts/gipltng.bat.in
+++ b/scripts/gipltng.bat.in
@@ -27,4 +27,4 @@ echo %BIN_DIR%
 
 set DNG_ROOT=%BIN_DIR%\..
 set PATH=%BIN_DIR%;%DNG_ROOT%\@LIBDIR@\Release;%DNG_ROOT%\@LIBDIR@;%DNG_ROOT%\bin\Release;%PATH%
-type "%DNG_ROOT%\@LIBDIR@\openstructure\init_iplt.py" | "%BIN_DIR%Release\gosty.exe" ost %*
+"%BIN_DIR%Release\gosty.exe" "%DNG_ROOT%\@LIBDIR@\openstructure\init_iplt.py" ost %*
diff --git a/scripts/gipltng.in b/scripts/gipltng.in
index a989d80b042124c7713388da7f62014873b57d53..0c30b759cd53719a66a8b3330e2019c0a9238da6 100755
--- a/scripts/gipltng.in
+++ b/scripts/gipltng.in
@@ -34,4 +34,4 @@ export LD_LIBRARY_PATH=$DNG_ROOT/@LIBDIR@:$LD_LIBRARY_PATH
 # line. If the HERE documnt is fed directly into gosty, the backtrace shows the 
 # full command in case of a segfault which is very confusing and not helpful 
 # at all
-cat $DNG_ROOT/@LIBDIR@/openstructure/init_img.py| gosty img $@
+gosty $DNG_ROOT/@LIBDIR@/openstructure/init_iplt.py img $@
diff --git a/scripts/init.py b/scripts/init.py
index 08f538045a05d3f143c6d18e20431650507170a8..066e3fb74ba31bdcdc69089d409a855784d5055e 100644
--- a/scripts/init.py
+++ b/scripts/init.py
@@ -69,12 +69,12 @@ def _load_files():
   graphical_objects=[]
   try:
     for f in input_files:
-      is_pdb_file=False
-      for ext in ['.pdb', '.ent', '.ent.gz', '.pdb.gz']:
-        if f[0].endswith(ext):
-          is_pdb_file=True
-          break
-      if is_pdb_file:
+      is_pdb_file=False
+      for ext in ['.pdb', '.ent', '.ent.gz', '.pdb.gz']:
+        if f[0].endswith(ext):
+          is_pdb_file=True
+          break
+      if is_pdb_file:
         es=io.LoadPDB(f[0], load_multi=True)
         for i, e in enumerate(es):
           index+=1
@@ -247,4 +247,6 @@ if len(loading_list)!=0 or len(options.pdb_ids)!=0:
   _load_files()
   scene.Autoslab()
 if len(script_argv)!=0:
-  _execute_script()
\ No newline at end of file
+  _execute_script()
+
+a=2