Improved ssh handling