Fixed event handler issue for message sending