controlling client sends stats to headless server ( buggy  !)

I have no clue what's wrong with this, someoen else needs to look at it :-( .
If a client leaves and another client takes over, I get crashes or OOS on new controlling client and I don't know why.
Without sending stats I had no trouble.