diff --git a/src/exec.c b/src/exec.c
index eb5f00c..7887bc4 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -101,8 +101,8 @@ gboolean
 ssh_cmd_upgrade(HostNode *n, const gboolean detached)
 {
  gboolean r;
+ guint i;
  GError *error = NULL;
- gchar *cmd = NULL;
  gchar **argv = NULL;
 
  g_assert(n);
@@ -116,20 +116,19 @@ ssh_cmd_upgrade(HostNode *n, const gboolean detached)
  he.action = "upgrade";
  he.data = NULL;
 
- gchar *screen = screen_new(n, detached);
+ gchar **screen_argv = screen_new(n, detached);
+
+ argv = (gchar **) g_malloc0(sizeof(gchar *) * (g_strv_length(screen_argv) + 2));
+ for(i = 0; i < g_strv_length(screen_argv); i++)
+   argv[i] = g_strdup(screen_argv[i]);
+ argv[i] = g_strdup(PKGLIBDIR"/cmd");
 
- cmd = g_strdup_printf ("%s%s",
-			screen, PKGLIBDIR"/cmd");
- g_free(screen);
+ g_strfreev(screen_argv);
 
 #ifdef FEAT_HISTORY
  n->parse_result = cfg->history_errpattern && strlen(cfg->history_errpattern);;
 #endif
 
- argv = g_strsplit(cmd, "+", 0);
-
- g_free(cmd);
-
  gchar **env = env_build(n, "upgrade", NULL, &he);
 
  r = g_spawn_sync(g_getenv ("HOME"), argv, env,
@@ -158,8 +157,8 @@ gboolean
 ssh_cmd_install(HostNode *n, gchar *package, const gboolean detached)
 {
  gboolean r;
+ guint i;
  GError *error = NULL;
- gchar *cmd = NULL;
  gchar **argv = NULL;
 
  g_assert(n);
@@ -173,21 +172,19 @@ ssh_cmd_install(HostNode *n, gchar *package, const gboolean detached)
  he.action = "install";
  he.data = package;
 
- gchar *screen = screen_new(n, detached);
+ gchar **screen_argv = screen_new(n, detached);
 
- cmd = g_strdup_printf ("%s%s",
-			screen, PKGLIBDIR"/cmd");
+ argv = (gchar **) g_malloc0(sizeof(gchar *) * (g_strv_length(screen_argv) + 2));
+ for(i = 0; i < g_strv_length(screen_argv); i++)
+   argv[i] = g_strdup(screen_argv[i]);
+ argv[i] = g_strdup(PKGLIBDIR"/cmd");
 
- g_free(screen);
+ g_strfreev(screen_argv);
 
 #ifdef FEAT_HISTORY
  n->parse_result = cfg->history_errpattern && strlen(cfg->history_errpattern);
 #endif
 
- argv = g_strsplit(cmd, "+", 0);
-
- g_free(cmd);
-
  gchar **env = env_build(n, "install", package, &he);
 
  r = g_spawn_sync(g_getenv ("HOME"), argv, env,
@@ -215,8 +212,8 @@ ssh_cmd_install(HostNode *n, gchar *package, const gboolean detached)
 void ssh_connect(HostNode *n, const gboolean detached)
 {
  gboolean r;
+ guint i;
  GError *error = NULL;
- gchar *cmd = NULL;
  gchar **argv;
 
  HistoryEntry he;
@@ -225,16 +222,14 @@ void ssh_connect(HostNode *n, const gboolean detached)
  he.action = "connect";
  he.data = NULL;
 
- gchar *screen = screen_new(n, detached);
-
- cmd = g_strdup_printf ("%s%s",
-			screen, PKGLIBDIR"/cmd");
+ gchar **screen_argv = screen_new(n, detached);
 
- g_free(screen);
+ argv = (gchar **) g_malloc0(sizeof(gchar *) * (g_strv_length(screen_argv) + 2));
+ for(i = 0; i < g_strv_length(screen_argv); i++)
+   argv[i] = g_strdup(screen_argv[i]);
+ argv[i] = g_strdup(PKGLIBDIR"/cmd");
 
- argv = g_strsplit(cmd, "+", 0);
-
- g_free(cmd);
+ g_strfreev(screen_argv);
 
  gchar **env = env_build(n, "connect", NULL, &he);
 
@@ -254,8 +249,8 @@ void ssh_connect(HostNode *n, const gboolean detached)
 void sftp_connect(HostNode *n)
 {
  gboolean r;
+ guint i;
  GError *error = NULL;
- gchar *cmd = NULL;
  gchar **argv;
 
  g_assert(n);
@@ -266,16 +261,14 @@ void sftp_connect(HostNode *n)
  he.action = "transfer";
  he.data = NULL;
 
- gchar *screen = screen_new(n, FALSE);
-
- cmd = g_strdup_printf ("%s%s",
-			screen, PKGLIBDIR"/cmd");
+ gchar **screen_argv = screen_new(n, FALSE);
 
- g_free(screen);
+ argv = (gchar **) g_malloc0(sizeof(gchar *) * (g_strv_length(screen_argv) + 2));
+ for(i = 0; i < g_strv_length(screen_argv); i++)
+   argv[i] = g_strdup(screen_argv[i]);
+ argv[i] = g_strdup(PKGLIBDIR"/cmd");
 
- argv = g_strsplit(cmd, "+", 0);
-
- g_free(cmd);
+ g_strfreev(screen_argv);
 
  gchar **env = env_build(n, "transfer", NULL, &he);
 
diff --git a/src/screen.c b/src/screen.c
index 0da8e6d..4e0c6ce 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -104,38 +104,43 @@ screen_get_sessions(HostNode *n) {
   return g_list_length(n->screens) > 0;
 }
 
-gchar *
+gchar **
 screen_new(HostNode *n, const gboolean detached) {
+  gchar **_argv = (gchar **) g_malloc0(sizeof(gchar *) * 8);
   gchar *title = parse_string(cfg->screentitle, n);
 
-  gchar *cmd = g_strdup_printf(SCREEN_BINARY"+-%sS+"SCREEN_SOCKPRE"%s_%s_%d"	\
-			       "+-t+%s+-c+%s+",
-			       detached ? "dm" : "",
-			       n->ssh_user, n->hostname, n->ssh_port,
-			       title,
-			       cfg->screenrcfile);
-
-  g_free(title);
-
-  return cmd;
+  _argv[0] = g_strdup(SCREEN_BINARY);
+  _argv[1] = g_strdup_printf("-%sS", detached ? "dm" : "");
+  _argv[2] = g_strdup_printf(SCREEN_SOCKPRE"%s_%s_%d", n->ssh_user,
+			     n->hostname, 
+			     n->ssh_port);
+  _argv[3] = g_strdup("-t");
+  _argv[4] = title;
+  _argv[5] = g_strdup("-c");
+  _argv[6] = g_strdup(cfg->screenrcfile);
+
+  return _argv;
 }
 
-static gchar *
+static gchar **
 screen_attach_cmd(const SessNode *s, const gboolean shared) {
-  return g_strdup_printf(SCREEN_BINARY"+-r%s+%d+", shared ? "x" : "", s->pid);
+  gchar **_argv = (gchar **) g_malloc0(sizeof(gchar *) * 4);
+
+  _argv[0] = g_strdup(SCREEN_BINARY);
+  _argv[1] = g_strdup_printf("-r%s", shared ? "x" : "");
+  _argv[2] = g_strdup_printf("%d", s->pid);
+
+  return _argv;
 }
 
 gboolean
 screen_attach(HostNode *n, const SessNode *s, const gboolean shared) {
  gboolean r;
  GError *error = NULL;
- gchar *cmd = screen_attach_cmd(s, shared);
- gchar **argv = NULL;
+ gchar **argv = screen_attach_cmd(s, shared);
 
  g_assert(n);
 
- argv = g_strsplit(cmd, "+", 0);
-
  r = g_spawn_sync(g_getenv ("HOME"), argv, NULL, 
 		  G_SPAWN_CHILD_INHERITS_STDIN, NULL, NULL,
 		  NULL, NULL, NULL, &error);
@@ -145,7 +150,6 @@ screen_attach(HostNode *n, const SessNode *s, const gboolean shared) {
   g_clear_error (&error);
  }
 
- g_free(cmd);
  g_strfreev(argv);
 
 #ifdef FEAT_HISTORY
@@ -158,32 +162,34 @@ screen_attach(HostNode *n, const SessNode *s, const gboolean shared) {
  return FALSE;
 }
 
-static gchar *
+static gchar **
 screen_dump_cmd(const SessNode *s, const gchar *fn) {
-  return g_strdup_printf(SCREEN_BINARY"+-S+%d+-X+hardcopy+%s", s->pid, fn);
+  gchar **_argv = (gchar **) g_malloc0(sizeof(gchar *) * 7);
+
+  _argv[0] = g_strdup(SCREEN_BINARY);
+  _argv[1] = g_strdup("-S");
+  _argv[2] = g_strdup_printf("%d", s->pid);
+  _argv[3] = g_strdup("-X");
+  _argv[4] = g_strdup("hardcopy");
+  _argv[5] = g_strdup(fn);
+  _argv[6] = NULL;
+
+  return _argv;
 }
 
 gchar *
 screen_get_dump(const SessNode *s) {
  gboolean r;
  GError *error = NULL;
- gchar **argv = NULL;
 
  gchar *dump_fn = g_strdup_printf("%s/dump-XXXXXX", g_get_tmp_dir());
  gint fd = g_mkstemp(dump_fn);
 
+ gchar **argv = screen_dump_cmd(s, dump_fn);
+
  if(fd == -1)
    return NULL;
 
- gchar *cmd = screen_dump_cmd(s, dump_fn);
- if(!cmd) {
-  g_unlink(dump_fn);
-  close(fd);
-  return NULL;
- }
-
- argv = g_strsplit(cmd, "+", 0);
-
  r = g_spawn_sync(g_getenv ("HOME"), argv, NULL, 
 		  G_SPAWN_CHILD_INHERITS_STDIN, NULL, NULL,
 		  NULL, NULL, NULL, &error);
@@ -193,7 +199,6 @@ screen_get_dump(const SessNode *s) {
   g_clear_error (&error);
  }
 
- g_free(cmd);
  g_strfreev(argv);
 
  gchar *c = NULL;
diff --git a/src/screen.h b/src/screen.h
index 95664bd..067623b 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -35,7 +35,7 @@
 gboolean
 screen_get_sessions(HostNode *n);
 
-gchar *screen_new(HostNode *n, const gboolean detached);
+gchar **screen_new(HostNode *n, const gboolean detached);
 gboolean screen_attach(HostNode *n, const SessNode *s, const gboolean shared);
 gchar *screen_get_dump(const SessNode *s);
 
