[FunctionAttrs] Fix an iterator wraparound bug