Rob Willett's cast fix for 64-bit Xcode compat