Fix sending messages bug

Related to #11, which merged pulled request introduced bug.