fixed control logic for endOfScan_static