Fix unregister and test