Unfortunately, the code I showed above is from a third-party tool (ComponentArt) so I do not have any controls over how their javascript objects are created. I may need to take this up with their support then.
But I still do not understand why does it works most of the time? If what you said is correct, shouldn't it breaks all the time? But this error only pops up once every 10 times or something. And once it works, it will always works, until I restart
IIS.