Fix accidental integer divison in range correction conditions