Correctly handle uneven data and line endings