modified capture.py and main.py(fix some bugs)