diff --git a/rank-swapper-agent/Makefile b/rank-swapper-agent/Makefile
index b5d328f88804b5ba50384c1809d77bf67fc51826..8645e801f6d6845978959731255461f4d4f72d29 100644
--- a/rank-swapper-agent/Makefile
+++ b/rank-swapper-agent/Makefile
@@ -1,6 +1,8 @@
 export OMPI := /home/openmpi-install
-export PATH := $(PATH):$(OMPI)/bin
-export LD_LIBRARY_PATH := $(LD_LIBRARY_PATH):$(OMPI)/bin
+# BEWARE: the order (custom OpenMPI first/prepended) is important since the
+# first gets picked and there may be other MPI installations on the system!
+export PATH := $(OMPI)/bin:$(PATH)
+export LD_LIBRARY_PATH := $(OMPI)/bin:$(LD_LIBRARY_PATH)
 # requirement: GNU make, see https://unix.stackexchange.com/questions/11530/adding-directory-to-path-through-makefile/261844#261844
 
 CC = gcc
diff --git a/rank-swapper-agent/client.sh b/rank-swapper-agent/client.sh
index 249f6e8181850d3f3cd1735d6a4bd59449ab41d9..19dad87afc5a708c164eaa2cda40b2bce49e4c37 100755
--- a/rank-swapper-agent/client.sh
+++ b/rank-swapper-agent/client.sh
@@ -1,9 +1,13 @@
 #!/bin/bash
 
-export OMPI=/home/openmpi-install
-export DPM_AGENT_SOCKET=$OMPI/dpm_socket_socket
-export PATH=$PATH:$OMPI/bin
-export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OMPI/bin
+# the export not done directly since not all shells allow the value of a
+# variable to be set at the same time it is exported
+OMPI=/home/openmpi-install; export OMPI
+DPM_AGENT_SOCKET=$OMPI/dpm_socket_socket; export DPM_AGENT_SOCKET
+# BEWARE: the order (custom OpenMPI first/prepended) is important since the
+# first gets picked and there may be other MPI installations on the system!
+PATH=$OMPI/bin:$PATH; export PATH
+LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OMPI/bin; export LD_LIBRARY_PATH
 
 PROCESSES=1