correct off by one error