You are right. I will give it a closer look when I have more time this evening or tomorrow.
On the fly it looks like the second parameter of ````nl2br```` would be the solution, we can just set is_xhtml = false and it will output html.
The question is need we support for < 5.3.0?