more resilient linebreak detection