Sort:  

To answer myself, looks like some weird formatting is going on with empty lines that become paragraphs and are wrongly nested. I fixed it by adding nbsp on empty lines.