Corrected error in minimizing scans