Fix caret position