diff --git a/README.md b/README.md
index e93fb9f..1938d8b 100644
--- a/README.md
+++ b/README.md
@@ -54,7 +54,7 @@ First line
Second line
* `ui:show_radio_dialog (title, lines, [index])` - show a dialog with a choice: title - title, lines - table of lines, index - index of the default value;
* `ui:show_checkbox_dialog(title, lines, [table])` - show dialog with selection of several elements: title - title, lines - table of lines, table - table default values.
-Dialog button clicks should be processed in the `on_dialog_action(number)` callback, where 1 is the first button, 2 is the second, and -1 is the "closed" button if no buttons were specified. `ui:show_edit_dialog()` returns the text in the `on_dialog_action(text)` callback.
+Dialog button clicks should be handled in the `on_dialog_action(number)` callback, where 1 is the first button, 2 is the second button, and -1 is nothing (dialog just closed). `ui:show_radio_dialog()` returns the index of the selected item or -1 in case the cancel button was pressed. `ui:show_checkbox_dialog()` returns the table of indexes or -1. `ui:show_edit_dialog()` returns text or -1.
If the first argument of the dialog contains two lines separated by `\n`, the second line becomes a subheading.
diff --git a/README_ru.md b/README_ru.md
index 8ca1d9a..10dc751 100644
--- a/README_ru.md
+++ b/README_ru.md
@@ -54,7 +54,7 @@ First line
Second line
* `ui:show_radio_dialog(title, lines, [index])` - показать диалог с выбором: title - заголовок, lines - таблица строк, index - индекс дефолтового значения;
* `ui:show_checkbox_dialog(title, lines, [table])` - показать диалог с выбором нескольких элементов: title - заголовок, lines - таблица строк, table - таблица дефолтовых значений.
-Нажатия на кнопки диалога должны обрабатываться в колбеке `on_dialog_action(number)`, где 1 - это первая кнопка, 2 - вторая, а -1 - нажатие кнопки "закрыть", если никакие кнопки не были указаны. `ui:show_edit_dialog()` возвращает текст в колбек `on_dialog_action(text)`.
+Нажатия на кнопки диалога должны обрабатываться в колбеке `on_dialog_action(number)`, где 1 - это первая кнопка, 2 - вторая, а -1 - нажатие кнопки "закрыть" или "назад". `ui:show_radio_dialog()` возвращает индекс выбранного элемента или -1 в случае нажатия кнопки "Отмена". `ui:show_checkbox_dialog()` возвращает таблицу индексов или -1. `ui:show_edit_dialog()` возвращает текст.
Если первый аргумент диалога содержит две строки, разделенных знаком `\n`, вторая строка станет подзаголовком.
diff --git a/samples/bad-script0.lua b/samples/bad-script0.lua
new file mode 100644
index 0000000..d2bfdf2
--- /dev/null
+++ b/samples/bad-script0.lua
@@ -0,0 +1,4 @@
+function on_resume()
+ while true do
+ end
+end