bug fix and changed extract.py