Explicit casts added

XCode/LLVM project fails to compile without those - there seems to be
some aggressive standards-conforming code generation requirement.