diff --git a/scripts/rootfs_remaster.sh b/scripts/rootfs_remaster.sh
index f5c1bb4ebc5736ec2bb212397985181adb370642..569c7c0f91feb6a5aa17fa3e4947a9e9b4e43705 100755
--- a/scripts/rootfs_remaster.sh
+++ b/scripts/rootfs_remaster.sh
@@ -82,9 +82,10 @@ function install_packages()
 	KERNEL_PKG=$(dpkg -S "$(readlink -f /vmlinuz)" | cut -d ":" -f1)
 	if [ -z "$KERNEL_PKG" ]; then
 		echo "LIPCK: remaster_rootfs: unable to determine installed kernel version; giving up..."
+		exit 1
 	fi
 	#[ "$(uname -m)" == "x86_64" ] || KERNEL_PKG=linux-image-generic-lts-trusty
-	if [ ! -e "$(readlink -f /initrd.img)" ]; then
+	if [ ! -e "$(readlink -f /vmlinuz)" ]; then
                 echo "LIPCK: No kernel in place; try to reinstall kernel image package:"
 		echo "       $KERNEL_PKG"
 		apt-get --reinstall -y install $KERNEL_PKG