better insert-mode bug fix