Fix parenthesis parsing bug in extract.py