fixed 2 bugs.\n 1. First record is always empty.\n 2. The last field can not be populated when missing newline.\n