Bug fix for offset insertion at the end of text.