Fixed a bug that sometimes caused the bot to get stuck in a tight loop if the IRC connection was broken.