Mass change problem

Hello, guys and girls.
I’ve encountered a glitch I can’t neither explain nor understand.
I dynamically change mass of a cube I’m looking at. What I want to do is change it by tens of kg’s while it’s under 100 kg and by 100’s when over 100 kg. I put in a few branches to check if mass is decreasing or increasing and to check the mass, and everything is working just fine, but if I go over 500, then back to 90 and up again, mass turns to 100, then to 110, and then goes by 100 as supposed to. I spent the entire day trying to figure it out, rearranging the bluescript logic in all possible ways I could imagine, but the result is always the same, and it’s driving me crazy. Maybe there’s a minor something I didn’t account for, but I just don’t know what it is. Can you help me maybe?

I tried to fit everything into one screenshot, so it might be not very good to read, sorry for that.

You can change the number of if statements you have there, might make it easier to follow. You don’t need to check if the mass is equal to 100 since it can only be 100 at that point. Just check if it is increasing then set the delta mass to 100 if it is, or 10 if not.