fix failed test. Add debug output to native code (can be compiled in conditionally)