diff --git a/set_env.sh b/set_env.sh
index b085f8b13a306c2862832310dd051017dd784b94..1ee25dd79735062a99e327c5f48c4ec6812cec1e 100644
--- a/set_env.sh
+++ b/set_env.sh
@@ -24,7 +24,7 @@ if [ -z $DESIGN_ROOT ]; then
     source $DESIGN_ROOT/set_env.sh
 else
     # Set Environment Variable for this Repository
-    export ACC_WRAPPER_DIR="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
+    export ACC_WRAPPER_DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]:-${(%):-%x}}")" && pwd)"
 
     # If this Repo is root of workspace
     if [ $ACC_WRAPPER_DIR = $DESIGN_ROOT ]; then
diff --git a/sourceme b/sourceme
index 12e0c2a8c432e82e3ea8f2689c7e5e5d010451e4..cbd7285bb6cc4cf59629f02927afa87ff5719f1c 100755
--- a/sourceme
+++ b/sourceme
@@ -13,7 +13,7 @@
 
 if [ -z "$ACC_WRAPPER_DIR" ]; then
     # Set environment Variables for Repository
-    export ACC_WRAPPER_DIR="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
+    export ACC_WRAPPER_DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]:-${(%):-%x}}")" && pwd)"
 
     if [ -z "$SOC_ENV_SET" ]; then
         # Add flow directory to Path