Fix scan gpu loop

This should fix Li's problem. Tests are still passing, including GPU.