Rename MSG to MESG to avoid conflicts with Windows header files