diff --git a/gitlab/functions.sh b/gitlab/functions.sh
index 2ae64b5f4a1b03918e3d40c50afd0060e47ead28..64749729a7591f000c0192629c473674d4184a70 100644
--- a/gitlab/functions.sh
+++ b/gitlab/functions.sh
@@ -2,6 +2,7 @@
 # Thu 22 Sep 2016 13:05:54 CEST
 
 # Build utilities
+SCRIPTS_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
 
 # Determines the operating system we're using
 osname() {
@@ -285,7 +286,7 @@ else
 fi
 
 # sets up certificates for curl and openssl
-CURL_CA_BUNDLE="$(dirname ${0})/cacert.pem"
+CURL_CA_BUNDLE="${SCRIPTS_DIR}/cacert.pem"
 export_env CURL_CA_BUNDLE
 SSL_CERT_FILE="${CURL_CA_BUNDLE}"
 export_env SSL_CERT_FILE