make setHex more efficient