Repair some atrocious pointer casts