fix problem that depends on last cursor position