Fix selection and cursor