Make sure hex values end on boundary

This is for #3476.