Fix for #2036

See discussion in #2036 for background on this.

This should fix it, although I'm not clear how this could happen in the first place...