added check for hasOwnProprty for remaining `for in` loops