Global variable doesn't seem to retain value

Hi
I use a global variable (rem) to work out the remainder for my Binary converter.
In the first block, the remainder is the input number - 8.
That value is assigned to rem. a broadcast is used to go to the next sprite.

Without applying any code, I used a “say” block to ddisplay the value of rem after the broadcast, and it changes to a negative number.

How?

Can you give us a link to the project so we can take a look at it?

im sorry i dont have any