Tidied up exceptions on connect and sending messages.