make library work with \r\n newlines

fixes #3