diff --git a/ci/build.sh b/ci/build.sh
index 78c65be9714b43001ac7bade982685fa781ab6ce..74727a3313a1f2ec553b355d19ed44c85b4e60c4 100644
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -32,7 +32,9 @@ test_target() {
         n=0
         until [ $n -ge $N ]
         do
-            rustup target add "${TARGET}" --toolchain "${RUST}" && break
+            if rustup target add "${TARGET}" --toolchain "${RUST}" ; then
+                break
+            fi
             n=$((n+1))
             sleep 1
         done
diff --git a/ci/dox.sh b/ci/dox.sh
index ff49298c1aac10824e5116a7c573cac4b0b80c63..6c0f1a0c640232d9212ec4403f3cd4a8e5420a98 100644
--- a/ci/dox.sh
+++ b/ci/dox.sh
@@ -38,8 +38,13 @@ while read -r target; do
     esac
 
     rustup target add "${target}" || true
-    xargo doc --target "${target}" \
-          --no-default-features  --features extra_traits
+
+    # If cargo doc fails, then try xargo:
+    if ! cargo doc --target "${target}" \
+             --no-default-features  --features extra_traits ; then
+        xargo doc --target "${target}" \
+              --no-default-features  --features extra_traits
+    fi
 
     cp -r "target/${target}/doc" "${TARGET_DOC_DIR}/${target}"