update cursor position in certain situations