fix link detection on end of lines