Fixed handling of different EOL indicators + some tests.