update Scanner.cpp by james