diff --git a/recovery.cpp b/recovery.cpp
index 4079927..4d1ad1d 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -69,6 +69,8 @@
 #include "ui.h"
 #include "screen_ui.h"
 
+struct selabel_handle *sehandle;
+
 static const struct option OPTIONS[] = {
   { "update_package", required_argument, NULL, 'u' },
   { "retry_count", required_argument, NULL, 'n' },
@@ -117,17 +119,14 @@
 // So we should check battery with a slightly lower limitation.
 static const int BATTERY_OK_PERCENTAGE = 20;
 static const int BATTERY_WITH_CHARGER_OK_PERCENTAGE = 15;
-static constexpr const char* RECOVERY_WIPE = "/etc/recovery.wipe";
-static constexpr const char* DEFAULT_LOCALE = "en_US";
+constexpr const char* RECOVERY_WIPE = "/etc/recovery.wipe";
 
-static std::string locale;
-static const char* stage = nullptr;
-static const char* reason = nullptr;
-static bool has_cache = false;
-
-RecoveryUI* ui = nullptr;
+RecoveryUI* ui = NULL;
+static const char* locale = "en_US";
+char* stage = NULL;
+char* reason = NULL;
 bool modified_flash = false;
-struct selabel_handle* sehandle;
+static bool has_cache = false;
 
 /*
  * The recovery tool communicates with the main system through /cache files.
@@ -207,9 +206,6 @@
 // close a file, log an error if the error indicator is set
 static void check_and_fclose(FILE *fp, const char *name) {
     fflush(fp);
-    if (fsync(fileno(fp)) == -1) {
-        PLOG(ERROR) << "Failed to fsync " << name;
-    }
     if (ferror(fp)) {
         PLOG(ERROR) << "Error in " << name;
     }
@@ -519,18 +515,24 @@
 // clear the recovery command and prepare to boot a (hopefully working) system,
 // copy our log file to cache as well (for the system to read). This function is
 // idempotent: call it as many times as you like.
-static void finish_recovery() {
+static void
+finish_recovery() {
     // Save the locale to cache, so if recovery is next started up
     // without a --locale argument (eg, directly from the bootloader)
     // it will use the last-known locale.
-    if (!locale.empty() && has_cache) {
-        LOG(INFO) << "Saving locale \"" << locale << "\"";
-
-        FILE* fp = fopen_path(LOCALE_FILE, "w");
-        if (!android::base::WriteStringToFd(locale, fileno(fp))) {
-            PLOG(ERROR) << "Failed to save locale to " << LOCALE_FILE;
+    if (locale != NULL) {
+        size_t len = strlen(locale);
+        __pmsg_write(LOCALE_FILE, locale, len);
+        if (has_cache) {
+            LOG(INFO) << "Saving locale \"" << locale << "\"";
+            FILE* fp = fopen_path(LOCALE_FILE, "w");
+            if (fp != NULL) {
+                fwrite(locale, 1, len, fp);
+                fflush(fp);
+                fsync(fileno(fp));
+                check_and_fclose(fp, LOCALE_FILE);
+            }
         }
-        check_and_fclose(fp, LOCALE_FILE);
     }
 
     copy_logs();
@@ -1280,32 +1282,40 @@
     printf("%s=%s\n", key, name);
 }
 
-static std::string load_locale_from_cache() {
-    if (ensure_path_mounted(LOCALE_FILE) != 0) {
-        LOG(ERROR) << "Can't mount " << LOCALE_FILE;
-        return "";
+static void
+load_locale_from_cache() {
+    FILE* fp = fopen_path(LOCALE_FILE, "r");
+    char buffer[80];
+    if (fp != NULL) {
+        fgets(buffer, sizeof(buffer), fp);
+        int j = 0;
+        unsigned int i;
+        for (i = 0; i < sizeof(buffer) && buffer[i]; ++i) {
+            if (!isspace(buffer[i])) {
+                buffer[j++] = buffer[i];
+            }
+        }
+        buffer[j] = 0;
+        locale = strdup(buffer);
+        check_and_fclose(fp, LOCALE_FILE);
     }
-
-    std::string content;
-    if (!android::base::ReadFileToString(LOCALE_FILE, &content)) {
-        PLOG(ERROR) << "Can't read " << LOCALE_FILE;
-        return "";
-    }
-
-    return android::base::Trim(content);
 }
 
-void ui_print(const char* format, ...) {
-    std::string buffer;
+static RecoveryUI* gCurrentUI = NULL;
+
+void
+ui_print(const char* format, ...) {
+    char buffer[256];
+
     va_list ap;
     va_start(ap, format);
-    android::base::StringAppendV(&buffer, format, ap);
+    vsnprintf(buffer, sizeof(buffer), format, ap);
     va_end(ap);
 
-    if (ui != nullptr) {
-        ui->Print("%s", buffer.c_str());
+    if (gCurrentUI != NULL) {
+        gCurrentUI->Print("%s", buffer);
     } else {
-        fputs(buffer.c_str(), stdout);
+        fputs(buffer, stdout);
     }
 }
 
@@ -1314,8 +1324,8 @@
 void UiLogger(android::base::LogId id, android::base::LogSeverity severity,
                const char* tag, const char* file, unsigned int line,
                const char* message) {
-    if (severity >= android::base::ERROR && ui != nullptr) {
-        ui->Print("E:%s\n", message);
+    if (severity >= android::base::ERROR && gCurrentUI != NULL) {
+        gCurrentUI->Print("E:%s\n", message);
     } else {
         fprintf(stdout, "%c:%s\n", log_characters[severity], message);
     }
@@ -1411,7 +1421,7 @@
     };
     std::string log_content = android::base::Join(log_buffer, "\n");
     if (!android::base::WriteStringToFile(log_content, TEMPORARY_INSTALL_FILE)) {
-        PLOG(ERROR) << "failed to write " << TEMPORARY_INSTALL_FILE;
+      PLOG(ERROR) << "failed to write " << TEMPORARY_INSTALL_FILE;
     }
 
     // Also write the info into last_log.
@@ -1563,24 +1573,18 @@
         }
     }
 
-    if (locale.empty()) {
-        if (has_cache) {
-            locale = load_locale_from_cache();
-        }
-
-        if (locale.empty()) {
-            locale = DEFAULT_LOCALE;
-        }
+    if (locale == nullptr && has_cache) {
+        load_locale_from_cache();
     }
-
-    printf("locale is [%s]\n", locale.c_str());
+    printf("locale is [%s]\n", locale);
     printf("stage is [%s]\n", stage);
     printf("reason is [%s]\n", reason);
 
     Device* device = make_device();
     ui = device->GetUI();
+    gCurrentUI = ui;
 
-    ui->SetLocale(locale.c_str());
+    ui->SetLocale(locale);
     ui->Init();
     // Set background string to "installing security update" for security update,
     // otherwise set it to "installing system update".
@@ -1595,7 +1599,7 @@
     if (show_text) ui->ShowText(true);
 
     struct selinux_opt seopts[] = {
-        { SELABEL_OPT_PATH, "/file_contexts" }
+      { SELABEL_OPT_PATH, "/file_contexts" }
     };
 
     sehandle = selabel_open(SELABEL_CTX_FILE, seopts, 1);
@@ -1767,7 +1771,7 @@
             break;
     }
     while (true) {
-        pause();
+      pause();
     }
     // Should be unreachable.
     return EXIT_SUCCESS;
