fixes for caret position