fixed a bug when there are multiple new lines