added debug_callback calls for debug mode