Fix undefined variable  in handlers.

The variable `msg` was used without being defined, leaking into the global scope.