fixing caret location