changd object check to use hasOwnProperty