scheduler lightbox problem

I currently have a scheduler for which I dynamically change the configuration of the lightbox based on event parameters in the onBeforeLightbox method. The readonly javascript file is imported to prevent editing in the lightbox. Requirements have however changed and some sections of the lightbox must now be editable. Upon removing the reference to the readonly js file, I find that the first attempt to configure the lightbox sections dynamically works OK, but all subsequent attempts end with an error :
Cannot read property ‘nextSibling’ of null (12:05:48:595 | error, javascript)
at scheduler._fill_lightbox (public_html/js/libs/scheduler/codebase/dhtmlxscheduler.js:2126:60)
at scheduler.showLightbox (public_html/js/libs/scheduler/codebase/dhtmlxscheduler.js:2120:37)
at scheduler._on_dbl_click (public_html/js/libs/scheduler/codebase/dhtmlxscheduler.js:843:131)
at _obj.ondblclick (public_html/js/libs/scheduler/codebase/dhtmlxscheduler.js:752:23)

Using scheduler pro version 4.1

Thanks in advance,