fix integer rounding issue