Fix codeblock wrapping implementation bugs #1735