maintengine.py has trouble with TypeError