Fixed several bugs in _sendMessage and helper methods.