diff --git a/sshcode.go b/sshcode.go
index 5ffda40..e3bfd02 100644
--- a/sshcode.go
+++ b/sshcode.go
@@ -321,12 +321,14 @@ func downloadScript(codeServerPath string) string {
 	return fmt.Sprintf(
 		`set -euxo pipefail || exit 1
 
+pkill -f %v || true
 mkdir -p ~/.local/share/code-server %v
 cd %v
 wget -N https://codesrv-ci.cdr.sh/latest-linux
 [ -f %v ] && rm %v
 ln latest-linux %v
 chmod +x %v`,
+		codeServerPath,
 		filepath.Dir(codeServerPath),
 		filepath.Dir(codeServerPath),
 		codeServerPath,
diff --git a/sshcode_test.go b/sshcode_test.go
index 318f7da..f6bd681 100644
--- a/sshcode_test.go
+++ b/sshcode_test.go
@@ -40,7 +40,7 @@ func TestSSHCode(t *testing.T) {
 	wg.Add(1)
 	go func() {
 		defer wg.Done()
-		err := sshCode("127.0.0.1", "", options{
+		err := sshCode("foo@127.0.0.1", "", options{
 			sshFlags:   testSSHArgs(sshPort),
 			localPort:  localPort,
 			remotePort: remotePort,