diff --git a/uncrypt/uncrypt.cpp b/uncrypt/uncrypt.cpp
index 4825041..20efbe4 100644
--- a/uncrypt/uncrypt.cpp
+++ b/uncrypt/uncrypt.cpp
@@ -41,6 +41,7 @@
 
 #include <errno.h>
 #include <fcntl.h>
+#include <inttypes.h>
 #include <linux/fs.h>
 #include <stdarg.h>
 #include <stdio.h>
@@ -74,14 +75,15 @@
 
 static int write_at_offset(unsigned char* buffer, size_t size, int wfd, off64_t offset) {
     if (TEMP_FAILURE_RETRY(lseek64(wfd, offset, SEEK_SET)) == -1) {
-        ALOGE("error seeking to offset %lld: %s\n", offset, strerror(errno));
+        ALOGE("error seeking to offset %" PRId64 ": %s\n", offset, strerror(errno));
         return -1;
     }
     size_t written = 0;
     while (written < size) {
         ssize_t wrote = TEMP_FAILURE_RETRY(write(wfd, buffer + written, size - written));
         if (wrote == -1) {
-            ALOGE("error writing offset %lld: %s\n", (offset + written), strerror(errno));
+            ALOGE("error writing offset %" PRId64 ": %s\n",
+                  offset + static_cast<off64_t>(written), strerror(errno));
             return -1;
         }
         written += wrote;
@@ -200,10 +202,10 @@
         return -1;
     }
 
-    ALOGI(" block size: %ld bytes\n", (long)sb.st_blksize);
+    ALOGI(" block size: %ld bytes\n", static_cast<long>(sb.st_blksize));
 
     int blocks = ((sb.st_size-1) / sb.st_blksize) + 1;
-    ALOGI("  file size: %lld bytes, %d blocks\n", (long long)sb.st_size, blocks);
+    ALOGI("  file size: %" PRId64 " bytes, %d blocks\n", sb.st_size, blocks);
 
     int range_alloc = 1;
     int range_used = 1;
@@ -211,8 +213,8 @@
     ranges[0] = -1;
     ranges[1] = -1;
 
-    fprintf(mapf.get(), "%s\n%lld %lu\n",
-            blk_dev, (long long)sb.st_size, (unsigned long)sb.st_blksize);
+    fprintf(mapf.get(), "%s\n%" PRId64 " %ld\n",
+            blk_dev, sb.st_size, static_cast<long>(sb.st_blksize));
 
     unsigned char* buffers[WINDOW_SIZE];
     if (encrypted) {
@@ -222,7 +224,6 @@
     }
     int head_block = 0;
     int head = 0, tail = 0;
-    size_t pos = 0;
 
     int fd = open(path, O_RDONLY);
     unique_fd fd_holder(fd);
@@ -242,6 +243,7 @@
         }
     }
 
+    off64_t pos = 0;
     int last_progress = 0;
     while (pos < sb.st_size) {
         // Update the status file, progress must be between [0, 99].
@@ -261,7 +263,7 @@
             add_block_to_ranges(&ranges, &range_alloc, &range_used, block);
             if (encrypted) {
                 if (write_at_offset(buffers[head], sb.st_blksize, wfd,
-                        (off64_t)sb.st_blksize * block) != 0) {
+                        static_cast<off64_t>(sb.st_blksize) * block) != 0) {
                     return -1;
                 }
             }
@@ -272,7 +274,7 @@
         // read next block to tail
         if (encrypted) {
             size_t so_far = 0;
-            while (so_far < sb.st_blksize && pos < sb.st_size) {
+            while (so_far < static_cast<size_t>(sb.st_blksize) && pos < sb.st_size) {
                 ssize_t this_read =
                         TEMP_FAILURE_RETRY(read(fd, buffers[tail] + so_far, sb.st_blksize - so_far));
                 if (this_read == -1) {
@@ -301,7 +303,7 @@
         add_block_to_ranges(&ranges, &range_alloc, &range_used, block);
         if (encrypted) {
             if (write_at_offset(buffers[head], sb.st_blksize, wfd,
-                    (off64_t)sb.st_blksize * block) != 0) {
+                    static_cast<off64_t>(sb.st_blksize) * block) != 0) {
                 return -1;
             }
         }
diff --git a/updater/blockimg.cpp b/updater/blockimg.cpp
index 50067d4..3b26f05 100644
--- a/updater/blockimg.cpp
+++ b/updater/blockimg.cpp
@@ -1670,6 +1670,9 @@
         return StringValue(strdup(""));
     }
 
+    // Output notice to log when recover is attempted
+    fprintf(stderr, "%s image corrupted, attempting to recover...\n", filename->data);
+
     // When opened with O_RDWR, libfec rewrites corrupted blocks when they are read
     fec::io fh(filename->data, O_RDWR);
 
@@ -1720,7 +1723,7 @@
             //     read and check if the errors field value has increased.
         }
     }
-
+    fprintf(stderr, "...%s image recovered successfully.\n", filename->data);
     return StringValue(strdup("t"));
 }
 
