more robust main.py