#451.  Avoid BadLocationException in ReplaceMode at the end of a file.