Fixed the  bug in Scanning.