Fix compilation warnings by using proper type conversion macros