I just discovered that replacing the first "return" inside the while loop with "break" prevents the bug from being triggered.
I just discovered that replacing the first "return" inside the while loop with "break" prevents the bug from being triggered.