fix selecting last character