fix execution with nested ssh

This fixes:

- rare problem with execution in local shell,
- when command contained nested `ssh`