Minor improvement to the way hooks are registered.