Added missing hasOwnProperty check into for-each