fix up back button and menu toggling
diff --git a/recovery.c b/recovery.c
index 7a12e10..e398393 100644
--- a/recovery.c
+++ b/recovery.c
@@ -49,6 +49,8 @@
   { NULL, 0, NULL, 0 },
 };
 
+static int allow_display_toggle = 1;
+
 static const char *COMMAND_FILE = "CACHE:recovery/command";
 static const char *INTENT_FILE = "CACHE:recovery/intent";
 static const char *LOG_FILE = "CACHE:recovery/log";
@@ -313,7 +315,7 @@
     int selected = 0;
     int chosen_item = -1;
 
-    while (chosen_item < 0) {
+    while (chosen_item < 0 && chosen_item != GO_BACK) {
         int key = ui_wait_key();
         int visible = ui_text_visible();
 
@@ -335,7 +337,8 @@
                 case NO_ACTION:
                     break;
                 case GO_BACK:
-                    return GO_BACK;
+                    chosen_item = GO_BACK;
+                    break;
             }
         } else if (!menu_only) {
             chosen_item = action;
@@ -394,7 +397,9 @@
         finish_recovery(NULL);
         ui_reset_progress();
 
+        allow_display_toggle = 1;
         int chosen_item = get_menu_selection(headers, MENU_ITEMS, 0);
+        allow_display_toggle = 0;
 
         // device-specific code may take some action here.  It may
         // return one of the core actions handled in the switch
@@ -530,3 +535,7 @@
     reboot(RB_AUTOBOOT);
     return EXIT_SUCCESS;
 }
+
+int get_allow_toggle_display() {
+    return allow_display_toggle;
+}
\ No newline at end of file