fix bug in scan.py