fix cursor position saving