also preserve cursor position