Add hook removal.

Add tests too, and fix logging in register.