diff --git a/integration-test.sh b/integration-test.sh
index bfb5562d924314c783ab2749e4ee9a09f9eecc96..443d6af65a3289910a86797f1fb92de8922c091e 100644
--- a/integration-test.sh
+++ b/integration-test.sh
@@ -23,6 +23,7 @@ install_keystore() {
     mkdir -p $tmpdir/src/git.autistici.org/id
     ln -s $PWD $tmpdir/src/git.autistici.org/id/keystore
 
+    pushd $tmpdir/src/git.autistici.org/id/keystore
     GOPATH=$tmpdir go build -o /usr/bin/dovecot-keylookupd cmd/dovecot-keylookupd
     GOPATH=$tmpdir go build -o /usr/bin/keystored cmd/keystored
     
@@ -43,6 +44,7 @@ install_keystore() {
     chown -R keystored /var/lib/keystore
 
     rm -fr $tmpdir
+    popd
 }
 
 configure_dovecot() {