Switch from ref to pointer to avoid type-pun warning on gcc