mostly correctly fixed old rounding bug