added casts in vtable generation to remove the warnings