C# Bot Gets Disconnected After Ping

EDIT: fixed, there was an IndexOutOfRange exception I overlooked.

Twitch sends me the ping, and I send the pong but the bot still gets disconnected.

C# Code

String[] ex = Data.Split(new char[] { ' ' }, 5);
if (ex[0] == "PING")
     Writer.WriteLine("PONG " + ex[1]);

PING :tmi.twitch.tv
PONG :tmi.twitch.tv

Anyone that knows what the problem might be?
I also tried making a new thread and sending a PONG every 5 minutes but same thing.

Not sure if you have aready fixed this but the PONG message shouldnt contain the : that was sent from the server, this needs stripping off.

PONG tmi.twitch.tv

Fixed this some time ago, there was an exception I missed and that caused the program to break.