ssh-related fixes and improvements