Fix bugs with the return value of sending message.