Fix for EOL detection from stdin. Patch from Bernd