diff --git a/get-modified-image.sh b/get-modified-image.sh
index 23bf3d3e9e82ecd396d6cd3554ca38bcd9cbe968..99a4ea6d2b8c0be5684a2782e9a5cf0c3a47bdc4 100755
--- a/get-modified-image.sh
+++ b/get-modified-image.sh
@@ -14,11 +14,18 @@ do
       ;;
   esac
 done
+
+if [ "$RES" = "" ]; then
+  echo "Error : no folder starting by pica or meta modified in last commit."
+  echo "Please check README.md for further understanding."
+  exit 1;
+fi
+
 echo "export MODIFIED_IMAGE=${RES}" > variables
 echo "Using modified folder : $RES"
 
 # Image name with wanted registry and tag, fetched from Docker Compose
-RES=$(cat $RES/docker-compose.yml | grep $RES: | cut -d ':' -f2- | cut -d '/' -f2- | tr -d ' ')
+RES=$(cat $RES/docker-compose.yml | grep $RES: | cut -d ':' -f2- | cut -d '/' -f2- | tr -d ' ' | head -n 1)
 if [ "$RES" = "" ]; then
   echo "Error : no reference to $RES found in docker-compose.yml."
   echo "Please check the repository README : the name of the folder must be the same as name of the image."