feature #2371: better fix for the extra new line in list