Better testing and fixes for the stack-customization code.