in main.py, bug fix for send failure