fixed bug with integer rounding