corrected calculation of currentSection