Perfomance fix
Add some debug hooks