Fix redundant hasOwnProperty check