fixed off-by-one in write_new_line()