all the other variables are already correct for %x). My previous attempt put the cast in the wrong place.