fix for #8088

fix for #8088, along with a test.