some fixes for empty selection and empty text