Fixing issues with ssh function