Further improvements to external commands handling