Sorry, reread your post and that definitely sounded like a bug, I admit I misread your post because it has 2 bugs, I think. My previous post definitely fixes that. This new one is a change that when lowered to 0 the ev stays at 0, allowing each consecutive stat lowering berry use to lower 1 iv each time. I did this because the growth model doesn't make sense in the backwards direction, as the ev would normally end up in the 200s and cause an overall higher stat, which would be easy to exploit. Not that there aren't countless other ways to exploit any Pokemon game. You might like this one better overall.
SWM - EvOverflow.rb