add hasOwnProperty to loops