diff --git a/tcp_tests/managers/execute_commands.py b/tcp_tests/managers/execute_commands.py
index 3c01867..29e2f4b 100644
--- a/tcp_tests/managers/execute_commands.py
+++ b/tcp_tests/managers/execute_commands.py
@@ -64,18 +64,20 @@
             # skip_fail = step.get('skip_fail', False)
 
             msg = "[ {0} #{1} ] {2}".format(label, n + 1, description)
-            LOG.info("\n\n{0}\n{1}".format(msg, '=' * len(msg)))
 
             if action_cmd:
-                self.execute_command(step)
+                self.execute_command(step, msg)
+                return
             elif action_do:
-                self.command2(step)
-            elif action_upload:
+                self.command2(step, msg)
+                return
+            LOG.info("\n\n{0}\n{1}".format(msg, '=' * len(msg)))
+            if action_upload:
                 self.action_upload(step)
             elif action_download:
                 self.action_download(step)
 
-    def execute_command(self, step):
+    def execute_command(self, step, msg):
         # Required fields
         cmd = step.get('cmd')
         node_name = step.get('node_name')
@@ -90,7 +92,13 @@
 
             for x in range(retry_count, 0, -1):
                 time.sleep(3)
-                result = remote.execute(cmd, verbose=True)
+
+                retry_msg = ' (try {0} of {1}, skip_fail={2})'.format(
+                    retry_count - x + 1, retry_count, skip_fail)
+                LOG.info("\n\n{0}\n{1}".format(
+                    msg + retry_msg, '=' * len(msg + retry_msg)))
+
+                result = remote.execute('set -ex; ' + cmd, verbose=True)
 
                 # Workaround of exit code 0 from salt in case of failures
                 failed = 0
@@ -106,16 +114,11 @@
 
                 if result.exit_code != 0:
                     time.sleep(retry_delay)
-                    LOG.info(
-                        " === RETRY ({0}/{1}) ========================="
-                        .format(x - 1, retry_count))
                 elif failed != 0:
                     LOG.error(
                         " === SALT returned exit code = 0 while "
                         "there are failed modules! ===")
-                    LOG.info(
-                        " === RETRY ({0}/{1}) ======================="
-                        .format(x - 1, retry_count))
+                    time.sleep(retry_delay)
                 else:
                     break
 
@@ -124,7 +127,7 @@
                     raise Exception("Step '{0}' failed"
                                     .format(description))
 
-    def command2(self, step):
+    def command2(self, step, msg):
         # Required fields
         do = step['do']
         target = step['target']
@@ -145,6 +148,11 @@
         for x in range(retry_count, 0, -1):
             time.sleep(3)
 
+            retry_msg = ' (try {0} of {1}, skip_fail={2})'.format(
+                retry_count - x + 1, retry_count, skip_fail)
+            LOG.info("\n\n{0}\n{1}".format(
+                msg + retry_msg, '=' * len(msg + retry_msg)))
+
             method = getattr(self._salt, self._salt._map[do])
             command_ret = method(tgt=target, state=state or states,
                                  args=args, kwargs=kwargs)
@@ -163,8 +171,6 @@
                 LOG.error("States finished with failures.\n{}".format(
                     all_fails))
                 time.sleep(retry_delay)
-                LOG.info(" === RETRY ({0}/{1}) ========================="
-                         .format(x - 1, retry_count))
             else:
                 break
 
