slight fix for /writeMsg function