Even with that, onconnect is called during the fast_restart used to go to next round/halftime. Might wanna remove the = undefined thing in there. It's undefined by default, when a client connects. Set it on first spawn, then never touch it again.
"Does not work" is an error report for a bug between keyboard and chair.