diff --git a/generate-deploy-stages.sh b/generate-deploy-stages.sh
index 73e6657f0f67675e66c1e55c2e6396eff2d871db..3f9851859d54f8edebe4695a99cb01385daaa701 100644
--- a/generate-deploy-stages.sh
+++ b/generate-deploy-stages.sh
@@ -5,7 +5,7 @@ basedir=$( cd "$(dirname "$0")" ; pwd -P )
 echo TRIGGER_PAYLOAD=$TRIGGER_PAYLOAD
 cat $TRIGGER_PAYLOAD 
 cat $TRIGGER_PAYLOAD | python3 -c "import sys, json; print(json.loads(json.load(sys.stdin)['payload'])['ref'])" | grep "uat"
-TAG=$(!!)
+TAG=$($(!!))
 touch deploy.yml
 if [ -z "${TAG}" ]; then
   git clone --single-branch --branch ${TAG} https://github.com/MAAP-Project/maap-workspaces.git