Interestingly, intval-- works properly, but unsignedval-- does not (test case fails). This is why menus blow up when opening the load/save sub-menu.