fix for msg.c bugs.