Adding null check on service unregister.