Cannot read property of undefined occurs when text is ending with ;; and you press a backspace on the next line. I'll have a look.