fixes infinite loop with ranges when called with uneven steps (ex: range(0, 3, 2))