Fix for #2892.
3. Fixed registerScriptObserver method.