Team set up issues

I have the following set up in my shared.lua of my gamemode:

[lua]TEAM_RED = 1

team.SetUp( TEAM_RED, “Red Team”, Color( 255, 0, 0, 255 ) )
team.SetUp( TEAM_BLUE, “Blue Team”, Color( 0, 0, 255, 255 ) )
team.SetUp( TEAM_SPEC, “the Spectators”, Color( 255, 255, 255, 255 ), false )[/lua]

Now, according to the wiki the team.SetUp syntax is the following:

[lua]team.SetUp( number teamIndex, string teamName, Color teamColor, boolean teamJoinable )[/lua]

My spectator team (TEAM_SPEC) is set to false for teamJoinable, which would make me assume that it would make it unable to be joined unless specifically set by the PlayerMeta:SetTeam() function.

Well, I have this in a function called to randomize the teams after a certain point:

[lua]for k,v in pairs(player.GetAll()) do
if v:Team() == TEAM_SPEC then continue end

Basically it loops through all players, ignores spectators, then sets teams based on the team.BestAutoJoinTeam() function. The issue is that it still sets players to TEAM_SPEC. Am I misreading the way the function operates? Or is it just one of those oddball things I’ll have to completely rewrite to make work for my gamemode?

[editline]24th October 2013[/editline]

Well, I decided to rewrite the function. Apparently the team.BestAutoJoinTeam doesn’t check to make sure the team is set to joinable…

[editline]24th October 2013[/editline]

Made a pull request with the check for BestAutoJoinTeam to the github.