Fix divide-by-zero in scan_engine.cc