Hello chehroma,
The size of the bounding box via script is defined as three component vector, so if you are changing the values the box is being shrink, but it's center remain untouched.
So if you need to "fix" one of the sides, you need not only to reduce the size of the box, but also to move the bounding box origin.