Fixed the usage of hasOwnProperty