Fixed #1470

* Only add new line if needed