fixed some bugs for Scanning.py to make sure the scanner works on all J1 test cases, with some minor exceptions