Since these are database ids, I think the behavior right now is correct.  0 isn't a valid database id (at least I think that's a valid assumption for databases I'm familiar with), so it will look for a badge with shortname "0" in that case.

That being said, this is a pretty poor way of doing things that I just kind of hacked together, and I plan to change this in my next major PR.  As far as I know, it's actually entirely legal to have a badge with the shortname "12345", and if such a badge was published, it would never successfully be found using this logic.