take back the debug function and fix a compile error