Fixed max length check.
Optimized calculation of acc length.