modified capture.py