Fixed serious bug that switching players in spectating mode might cause program to enter an infinite loop