fixing bug where current segment was being used in calculations for should stop on recursion