For now objects are exposed to script with their declared "return type", and corresponding script object is cached while script is holding a reference to it. But if an object would exposed to script second time with another return type (subtype or supertype), it gonna be exposed as old cached script object with wrong method table and stuff.
To fix that we have to cache script objects taking into account the exposed type, and make several script objects - one for each exposed type of object. Note that reclaiming object should clear all types of object at once.