More fixes for badge numbering and renumbering

Implements fixes for bugs found while testing manually.