Improves auto incrementing

Fixes a bug where new badges were being assigned the same number as the
last badge in the range.