remove use of undefined variable 'msg'