Fix crash when sending a message