Added an index check when removing a player.