fix bug where blank line were removed and content from non-blank lines accidentally concatenated