Fix error that caused lines to be overwritten.
Fixed error causing lines to be overwritten.