updated the debug function