Protect against iterating over custom/inherited array members

Fixes issue #455.