trim newlines from empty lines
extend test case to show the return bug