Fixed sending of messages in certain cases. Sending of message is now in a separate thread. More thread/queue issues for sending/receiving will be fixed later.