Fix crash bug in debug_fns