Correct errors with last character of a line