fix issues when the range is negative

for example, -10 to 0 with step 1