Fix dirname bug in parse.py