Did some more testing today and found that the issue is only present at exactly attribute level 5. If I have Strength5 the script spits out Strength6 flag. But if I actually have Strength6 I only get 6 (and not 7). So it's only giving me an extra flag on level 5.

I tried this up to level 10 and got the same results.
5=6
6=6
7=7
8=8
etc.