Change one indexOf to hasOwnProperty