Fixed an error in the sendMsg method