Fix potential crash on server stop.