RUBY-15071: restoring an old logic which fights with extra new-lines