fixed bug in sending messages