Fixes #592

If the Array prototype was extended, the framework could create
iteration errors. The code was hardened to prevent it.