fix caret pos changing