the code is currently handling the case of ``debug`` existing already, but it does not check ``set_debug_handler``, which can create some issues (it will be solved by my suggestion above though)