diff --git a/webservice/webservice.py b/webservice/webservice.py
index aabc47020378f34a59bc8850581c65d9c446c8b6..02f682daf0277fee4ca370fe205e0226bf3391e1 100644
--- a/webservice/webservice.py
+++ b/webservice/webservice.py
@@ -8,6 +8,7 @@ import json
 import locale
 import logging
 import os
+import shlex
 import sqlite3
 import sys
 import urllib.parse
@@ -1171,17 +1172,16 @@ class ActionsServer:
                 time_stamp=datetime.now().strftime('%y%m%d_%H%M%S'),
                 det_instance=karabo_id,
                 request_time=request_time
-            )
+            ).split()
+            cmd = parse_config(cmd, dconfig)
 
             with self.job_db:
                 cur = self.job_db.execute(
                     "INSERT INTO executions VALUES (NULL, ?, ?, ?, ?, NULL)",
-                    (req_id, cmd, detector, karabo_id)
+                    (req_id, shlex.join(cmd), detector, karabo_id)
                 )
                 exec_id = cur.lastrowid
 
-            cmd = cmd.split()
-            cmd = parse_config(cmd, dconfig)
             # TODO: Add detector info in returned run action status.
             ret.append(await run_action(
                 self.job_db, cmd, self.mode,