added even more error handling for type-stats.py