Trouble on item open and close

I’m having a problem when close or open specific branches (or after specific branches).
The trouble is that it doesn’t close properly, I mean it doesn’t hide all the subitems of the corresponding branch and gives me some errors on the console.

Uncaught TypeError: Cannot read property ‘removeChild’ of null
at window..dhtmlXGridObject.collapseKids (dhtmlx.js:9)
at window..dhtmlXGridObject.doExpand (dhtmlx.js:9)

Uncaught TypeError: Cannot read property ‘insertBefore’ of null
at window..dhtmlXGridObject._massInsert (dhtmlx.js:9)
at window..dhtmlXGridObject.expandKids (dhtmlx.js:9)
at window..dhtmlXGridObject.doExpand (dhtmlx.js:9)

I have checked the JSON and everything is ok, also the visualization is perfect, so I don’t know where the problem is.

The above branches open / close correctly, only from a specific branch and foremost, none of them works correctly. This error also occurs when you try to close the branch above this.

I’m working whit a +2K rows tree. And each branch has like 50-70 items.
Also, the branch that is causing this trouble is like level 4-5 on my tree.

could you please, provide a complete demo or a demo link, where the prioblem can be reconstructed.