properly create message according to msg_type field