Fix undeclared variable in the sendMessage() method