Fix debug build for nw0.8

Back port a patch from 4dabdca247156edf14753714e317c8e2f31e3b15 to fix the debug build of 0.8 branch.