encode BIT STRING in a minimum number of bits for CANONICAL-UPER
diff --git a/tests/tests-randomized/check-bundles.sh b/tests/tests-randomized/check-bundles.sh
index f9e2b4d..3ba312d 100755
--- a/tests/tests-randomized/check-bundles.sh
+++ b/tests/tests-randomized/check-bundles.sh
@@ -66,7 +66,7 @@
     echo "Testing [$asn] ${where}"
 
     mkdir -p ${RNDTEMP}
-    if (cd ${RNDTEMP} && compile_and_test "$asn" "$@"); then
+    if (set -e && cd ${RNDTEMP} && compile_and_test "$asn" "$@"); then
         echo "OK [$asn] ${where}"
         tests_succeeded=$((tests_succeeded+1))
     else
@@ -134,7 +134,7 @@
         done
     fi
 
-    return 0;
+    return 0
 }
 
 asn_compile() {
@@ -150,8 +150,11 @@
     test ! -f Makefile.am   # Protection from accidental clobbering
     echo "Test DEFINITIONS ::= BEGIN $asn" > test.asn1
     echo "END" >> test.asn1
-    ${abs_top_builddir}/asn1c/asn1c -S ${abs_top_srcdir}/skeletons \
+    if ! ${abs_top_builddir}/asn1c/asn1c -S ${abs_top_srcdir}/skeletons \
         -gen-OER -gen-PER test.asn1
+    then
+        return 1
+    fi
     rm -f converter-example.c
     ln -sf ../random-test-driver.c || cp ../random-test-driver.c .
     echo "CFLAGS+= -DASN1_TEXT='$short_asn'" > Makefile