fixed bug in lengthTracker method