moved hasOwnProp out of the closure