diff --git a/src/Manager/SuccessManager.php b/src/Manager/SuccessManager.php
index 37268df729e9914308a037652327e96583f8047d..88d6933396cee08254d32524eb88e3f7bc111c33 100644
--- a/src/Manager/SuccessManager.php
+++ b/src/Manager/SuccessManager.php
@@ -124,7 +124,7 @@ class SuccessManager
             }
         }
         $currentMilestone = $success->getCurrentMilestone();
-        if ($newPosition > $currentMilestone) {
+        if ($newPosition > $currentMilestone && $currentMilestone < count($successMilestones) - 1) {
             $success->setCurrentMilestone($newPosition);
             $success->getUser()->setUserPoints($success->getUser()->getUserPoints() + $success->getSuccessPoints()[$currentMilestone]);
         }
diff --git a/src/Manager/WiktionaryManager.php b/src/Manager/WiktionaryManager.php
index f4a4374f12cc3d24b79c46bad59d54df0534eac1..fbe33c2a7dc2060902e180f80b309717c2314e01 100644
--- a/src/Manager/WiktionaryManager.php
+++ b/src/Manager/WiktionaryManager.php
@@ -12,6 +12,9 @@ use Symfony\Component\HttpFoundation\Response;
 use Symfony\Component\Routing\Annotation\Route;
 use Symfony\Component\Serializer\SerializerAwareInterface;
 use Symfony\Component\Serializer\SerializerInterface;
+use Symfony\Component\HttpClient\HttpClient;
+use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
+use Symfony\Component\HttpClient\Exception\ClientException;
 
 class WiktionaryManager
 {
@@ -33,6 +36,7 @@ class WiktionaryManager
      * @param $word
      * @param $language
      * @return mixed
+     * @throws \Exception|TransportExceptionInterface
      */
     public function search($word, $language)
     {
@@ -42,41 +46,44 @@ class WiktionaryManager
             return $this->lastSearch['data'];
         }
 
-//  usage: wikstraktor.py [-h] [-l LANGUAGE] [-w WIKI_LANGUAGE] [-m MOT]
-//                      [-f DESTINATION_FILE] [-A] [-C]
-//
-//  Interroger un wiktionnaire
-//	ex :
-//	‣./wikstraktor.py -m blue
-//	‣./wikstraktor.py -m blue -f blue.json -A -C
-//	‣./wikstraktor.py -l en -w fr -m blue -f blue.json -A -C
-
-//        options:
-//        -h, --help            show this help message and exit
-//    -l LANGUAGE, --language LANGUAGE
-//                        la langue du mot
-//    -w WIKI_LANGUAGE, --wiki_language WIKI_LANGUAGE
-//                        la langue du wiki
-//    -m MOT, --mot MOT     le mot à chercher
-//    -f DESTINATION_FILE, --destination_file DESTINATION_FILE
-//                        le fichier dans lequel stocker le résultat
-//    -A, --force_ascii     json avec que des caractères ascii
-//    -C, --compact         json sans indentation
-
-
-	//$time_start = microtime(true); /*Debug*/
-
-        if ($_ENV['WIKTIONARY_TOOL'] == 'WIKSTRAKTOR') {
-            $command = $_ENV['WIKSTRAKTOR_COMMAND'] . ' -l ' . $language . ' -w ' . $language . ' -m "' . $word . '" -A -C 2>&1';
-        } else {
-            $command = $_ENV['WIKTEXTRACT_COMMAND'] . ' -l ' . $language . ' -w ' . $language . ' -e "' . $word . '"' . ' -zA 2>&1';
+	    //$time_start = microtime(true); /*Debug*/
+
+        $url = 'http://localhost:5000/search/' . $language . '/' . $language . '/' . $word . '/a_wikstraktor';
+        $client = HttpClient::create();
+        $result = null;
+
+// Make the initial request with a timeout
+        try {
+            $response = $client->request('GET', $url);
+            // dump($response->getStatusCode());die();
+
+            // Check the HTTP status code
+            if ($response->getStatusCode() === 200) {
+                // Server is up and returned a successful response
+                $result = $response->getContent();
+            }
+        } catch (TransportExceptionInterface $exception) {
+            if (empty(exec('ps aux | grep "[a]pp.py"'))) {
+                // Server is down, restart it
+                exec('nohup /var/www/live-query-wiktextract/venv/bin/python3 /var/www/live-query-wiktextract/src/app.py');
+                if (!empty(exec('ps aux | grep "[a]pp.py"'))) {
+                    $response = $client->request('GET', $url);
+
+                    if ($response->getStatusCode() === 200) {
+                        // Server is up and returned a successful response
+                        $result = $response->getContent();
+                    }
+                } else {
+                    throw new \Exception('Server is down');
+                }
+            }
         }
 
-        $result = exec($command);
-	//dump($word);dump($command);dump(microtime(true)-$time_start);dump($result);die();/*Debug*/
+	    //dump(gettype($result));dump($url);dump(microtime(true)-$time_start);dump($result);/*Debug*/
 	// Output and error handling
 
         $dataArray = json_decode($result, true);
+        //dump(gettype($dataArray));dump($dataArray);die();/*Debug*/
 
         // On sauvegarde la recherche pour optimiser le nb de requêtes vers le wiktionnaire
         $this->lastSearch = [
@@ -87,8 +94,7 @@ class WiktionaryManager
 
 //dump(json_last_error());
 //dump(json_last_error_msg());
-//dump($dataArray);die(); Wiktionary
-
+        //dump($dataArray);die();
         return $dataArray;
     }
 
@@ -135,14 +141,17 @@ class WiktionaryManager
         $morphologicalLabels = [];
 
         $entryData = [];
-        $word = array_keys($wiktionaryData[0])[2];
+        $excludedKeys = ["id", "sources", "translations"];
+        $allKeys = array_keys($wiktionaryData[0]);
+        $single = array_diff($allKeys, $excludedKeys);
+        $word = reset($single);
         $entryData['Headword'] = $word;
 
         $items = [];
         foreach ($wiktionaryData as $pos) {
-            if (array_keys($pos)[2] != $word) {
+            /*if (array_keys($pos)[3] != $word) {
                 throw new \Exception(sprintf("Items se rapportant à des mots différents dans les données du wiktionnaire pour le mot %s.", $word));
-            }
+            }*/
 
             $posData = $pos[$word];
             $item = [];
diff --git a/src/Twig/AppTwigExtension.php b/src/Twig/AppTwigExtension.php
index ba239a375cb94bd975fc4a39d19a169f08cf594f..6a26a053b4ae1aa56d711eae9b08d206167114a3 100644
--- a/src/Twig/AppTwigExtension.php
+++ b/src/Twig/AppTwigExtension.php
@@ -102,7 +102,7 @@ class AppTwigExtension extends AbstractExtension
         $nextMilestoneIndex = $currentMilestone < $numSuccesses - 1 ? $currentMilestone + 1 : $numSuccesses - 1;
 
 
-        $progressPercentage = ($counter - $successMilestones[$currentMilestone]) / ($successMilestones[$currentMilestone+1] - $currentMilestone) * 100; // Calculate progress percentage
+        $progressPercentage = ($counter - $successMilestones[$currentMilestone]) / ($successMilestones[min($currentMilestone+1, $numSuccesses-1)] - $currentMilestone) * 100; // Calculate progress percentage
         // Define CSS styles for the progress bar container and fill
         $containerStyle = sprintf('background-color: %s;', $successColors[1]); // Use the first color in $successColors for the container background
         $fillStyle = sprintf('background-color: %s; width: %s%%;', $successColors[0], $progressPercentage); // Use the second color in $successColors for the fill
@@ -119,7 +119,16 @@ class AppTwigExtension extends AbstractExtension
             $currentReward = $this->renderRewardImageSmall($successMilestones[$currentMilestone], $successMilestones[$currentMilestone], $successName);
         }
 
-        $nextReward = $this->renderRewardImageSmall($successMilestones[$nextMilestoneIndex], $successMilestones[$currentMilestone], $successName);
+        if($currentMilestone == $numSuccesses - 1 )
+        {
+            $nextReward = $this->renderRewardImageSmall($successMilestones[$currentMilestone], $successMilestones[$currentMilestone], $successName);
+        }
+        else
+        {
+            $nextReward = $this->renderRewardImageSmall($successMilestones[$nextMilestoneIndex], $successMilestones[$currentMilestone], $successName);
+        }
+
+
 
 
         // Return the concatenated HTML for rewards and progress bar
@@ -202,4 +211,4 @@ class AppTwigExtension extends AbstractExtension
         }
     }
 
-}
\ No newline at end of file
+}