more robust \r\n / \n handling