diff --git a/stpkg b/stpkg
index 875515bb8636d5b38ec061ee4a46c99013decb96..c26f5315602443022f2785813d85e16c2bcb1e06 100755
--- a/stpkg
+++ b/stpkg
@@ -233,9 +233,9 @@ __upload_file() {
     fi
 
     # TODO: Use jq here
-    curl -s -X POST -H \
+    MXC=$(curl -s -X POST -H \
         "Content-Type: $TYPE" --data-binary "@$FILE" "https://$STPKG_HOMESERV/_matrix/media/r0/upload?access_token=$STPKG_TOKEN" | \
-        tee /tmp/toto | python -c "import sys, json; print(json.load(sys.stdin)['content_uri'])"
+        tee /tmp/toto | python -c "import sys, json; print(json.load(sys.stdin)['content_uri'])")
     [ $? -ne 0 ] && die "Failed to upload sticker $NAME for pack $PACK_NAME to $STPKG_HOMESERV"
 }
 
@@ -686,7 +686,8 @@ process_sticker_file() {
     DEST_HEIGHT=$(file_get_height "$TEMP")
 
     # Upload the transformed file
-    local MXC=$(__upload_file "$DEST_TYPE" "$TEMP" "$NAME")
+    local MXC
+    __upload_file "$DEST_TYPE" "$TEMP" "$NAME"
     rm "$TEMP"
 
     JSON_REF=$(create_sticker_json "$PACK_NAME" "$NAME" "$DEST_WIDTH" "$DEST_HEIGHT" "$DEST_TYPE" "$MXC")