fix clearing the script object cache

do not remove all cache entries matching only the instance address:
Also check the constness flag same as its is used in other places
when working with the cache.
Merge pull request #38 from cpgf/fix-cleaning-script-object-cache

fix clearing the script object cache