fixed bug in msg_set_code