Only unregister client id when necessary
Merge bug25744