fix selecting last newline error