Add missing hasOwnProperty check in for-in loop.