Fix and optimization for serial scan mode.