fix casts on 32-bit