bug fix in sending messages