Debug init and final function