major bug fix for analyze.py