worked on some bugfixing for the message sending code