[PATCH] Make the TUI mainloop more resistant to screen implementation errors