I increment $Address in the second line of the for loop with $Address++. Is this an improper way to do this? Because the script works fine, up to the point where you pass it a character, then it produces the bug I described.
Thanks to everyone, it was indeed that I hadn't converted it from a string to a regular number before the applying the necessary math to it. Thanks guys!