Make helpers.py more robust