fix retrieving line separator, add unit test