Serious problems with Editor DHTMLX 5.1

I am trying to implement an editor on a layout:

tCell = laySurvEditTop.cells(“a”);

if I use this:

        	introEditor = tCell.attachEditor({
        		content:introCont
        	,	toolbar: true
        	,	iconsPath: "/assets/DHTMLX51/imgs"
        	});

It works, but the introEditor.getContents() fails with:

Uncaught TypeError: Cannot read property ‘document’ of null
at dhtmlXEditor.getContent (dhtmlx.js:9)
at dhtmlXToolbarObject. (survEdit.js:606)
at dhtmlXToolbarObject.a.callEvent (dhtmlx.js:9)
at HTMLDivElement._doOnMouseUp (dhtmlx.js:9)

If I try to initialize editor in another way:

        	introEditor = new dhtmlXEditor({
        		parent: tCell
        	,	content:introCont
        	,	toolbar: true
        	,	iconsPath: "/assets/DHTMLX51/imgs"
        	});

initialization fails with:

dhtmlx.js:9 Uncaught TypeError: Cannot read property ‘length’ of undefined
at new dhtmlXEditor (dhtmlx.js:9)
at dhtmlXForm. (survEdit.js:592)
at dhtmlXForm.a.callEvent (dhtmlx.js:9)
at dhtmlXForm. (dhtmlx.js:9)
at dhtmlXForm.a.callEvent (dhtmlx.js:9)
at HTMLDivElement.C.callEvent (dhtmlx.js:9)
at HTMLDivElement.c.firstChild.ontouchend.c.firstChild.onmouseup [as ontouchend] (dhtmlx.js:9)
dhtmlXEditor @ dhtmlx.js:9
(anonymous) @ survEdit.js:592
a.callEvent @ dhtmlx.js:9
(anonymous) @ dhtmlx.js:9
a.callEvent @ dhtmlx.js:9
C.callEvent @ dhtmlx.js:9
c.firstChild.ontouchend.c.firstChild.onmouseup @ dhtmlx.js:9

Line 592 is the "introEditor = new dhtmlxEditor … "

Please help!

Unfortunately the problem cannot be reconstructed locally:
http://snippet.dhtmlx.com/e4dd06ada
http://snippet.dhtmlx.com/a594592c3
both scenarios works well for me.

If the problem still occurs for you please, provide a more detailed sample or a snippet, where the problem can be reproduced.

Funny thing is the moment I switched from DHXTML 5.1 back to 4.6 it works fine!

Could you please, provide a complete demo or share a demo link, where the problem can be reproduced.