fix SendMessage bugs