fix bug that overlays may disturb cursor position