diff --git a/matrixpack.sh b/matrixpack.sh
index 82964a1c01167ed195badbfa1a60cb43976c597e..dd4370c87fc98e4c04165a1bd9406655829c7ce4 100755
--- a/matrixpack.sh
+++ b/matrixpack.sh
@@ -44,10 +44,7 @@ if test $# -lt 3 ; then
 fi
 
 # Setting variables
-dir=$(pwd)
 token=$1
-packname=${dir##*/}
-slug=$(slugify "$packname")
 homeserver=$(slug_homeserver $2)
 
 # Checking if the homeserver exist.
@@ -86,6 +83,9 @@ do
 
     # Changing directory to work directly in it
     cd "$i"
+    dir=$(pwd)
+    packname=${dir##*/}
+    slug=$(slugify "$packname")
 
     # Printing informations
     echo -e "Creating sticker pack : \033[94;1m$packname\033[0m\nhomeserver=\033[94m$homeserver\033[0m\noutput=\033[94m$slug\033[0m"