That version works on the several scripts I have tried.
One thing I noticed intermittently is that sometimes while going through the CHDK menus, the entire CHDK overlay erases itself. It's still running the menu code, but there is no menu shown, no OSD, etc. Exiting and re-entering menu mode makes things look OK again.