Adding many type casts in order to remove warnings coming for the C/C++ compiler.