add support for $maxScan.  fixes #496