is there a way to avoid `hasOwnProperty` here?