fixed issue with getmsg function