add a new as_hex function