Fix bug where number of ticks run is less than requested

I introduced this bug a while back.