Fix scan for very large scans (> 2^31)