To change the max number of badges, go to the Debug_Menu script section and find this piece of code:
and then change the 24's to the number of Badges you want to use. In your case, it's 40, in my case, it's 64.
Here is what it looks like in the Debug Menu after editing the scripts: