Remove some hasOwnProperty duplications.