Fixed some ring-wrap-around errors with key redistribution.