fix divsion by zero due to rounding error