finally got a rounding problem solved (I hope)