diff --git a/centos8_snapshots/mksnapshot.sh b/centos8_snapshots/mksnapshot.sh
index 3b508e6f8e0fb9e8e3d43b29a1361726d418c132..e669cf83ffa7877495986ff914ebe6f6daa3b1a6 100755
--- a/centos8_snapshots/mksnapshot.sh
+++ b/centos8_snapshots/mksnapshot.sh
@@ -15,10 +15,10 @@ ADVISORY_DB_PATH="/advisories/c8X"
 # For now, we use the same errata links for both archs
 # Use https://www.sqlite.org/uri.html for read-only mode, use .db.bak if existent to avoid deadlocks with https://gitlab.cern.ch/linuxsupport/cronjobs/advisories
 if [ -f "$ADVISORY_DB_PATH/x86_64/updateinfo.db.bak" ]; then
-  echo "Advisories generation is currently running, use backup file to avoid deadlocks"  
+  echo "Advisories generation is currently running, use backup file to avoid deadlocks"
   SQLITE="/usr/bin/sqlite3 file:$ADVISORY_DB_PATH/x86_64/updateinfo.db.bak?mode=ro"
-else 
-  echo "Advisories generation is NOT running, fallback to main file"  
+else
+  echo "Advisories generation is NOT running, fallback to main file"
   SQLITE="/usr/bin/sqlite3 file:$ADVISORY_DB_PATH/x86_64/updateinfo.db?mode=ro"
 fi
 
diff --git a/centos8_snapshots/triggers.sh b/centos8_snapshots/triggers.sh
index 9f54a2d2a0e1f4e5ae44be00098839f013083d9a..16064e6320cbc397c5ea23e0c891fab3ac564f67 100755
--- a/centos8_snapshots/triggers.sh
+++ b/centos8_snapshots/triggers.sh
@@ -113,7 +113,8 @@ fi
 # The only kernel RPM required for the BUILD is kernel-devel - for testing the RPM kernel-core will be required.
 if grep -q ";kernel-core;" $REPO_DIFF; then
   # Since we might be generating the kmod openafs rpm ourselves, first check if it exists
-  KERNEL_DIFF=$(grep ";kernel-core;" $REPO_DIFF | tail -n1)
+  # We need that crazy sort to grab the newest RPM, just in case there are several
+  KERNEL_DIFF=$(grep ";kernel-core;" $REPO_DIFF | sort -V -k 3,4 -t ';' | tail -n1)
   AFS_KVER=$(echo $KERNEL_DIFF | head -n1 | awk -F\; '{print $3 "_" $4}')
   KMOD_AFS="kmod-openafs-${AFS_VER}.${AFS_KVER}.${DIST}.x86_64.rpm"
   KMOD_URL="http://linuxsoft.cern.ch/internal/repos/openafs8-stable/x86_64/os/Packages/${KMOD_AFS}"