Fixed Uncaught Type Error with hasOwnProperty()