use hasOwnProperty and update tests