fix for #7093

This fixes the same bug 3 different ways; I think they are all worthwhile
patches to go in.