Added more robust checking for array and object types

instanceof Array and obj.constructor were failing to correctly check the
type of model objects when used in a cross frame scenario. This fixes
the issue.