It might be useful to use `msg` in the debug log (it seems to be unused otherwise).