Added two missing hasOwnProperty checks

Without this kind of hasOwnProperty check, for-each loops break if properties have been added to Object.prototype.