Added hasOwnProperty to make it work in IE.