backport of maxDataPoints patch