added deregister function