Advanced debug message handler
Fix bug in grid2d test