Maybe calculate N once and store it in a local variable to match old behavior?