fixed crash when sending messages