Fix a crash when restarting the client