This amends 66a491bd. There are a few more cases that had been overlooked in the original patch. (cherry picked from commit 2556378d)